diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f1df04c8a3a..90cc93ae6c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,7 +55,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ['10', '12'] + node: ['10', '12', '17'] name: Node ${{ matrix.node }} (Linux) steps: - name: Checkout Commit @@ -71,8 +71,28 @@ jobs: env: CI: true + macos: + runs-on: macos-latest + strategy: + matrix: + node: ['12', '16'] + name: Node ${{ matrix.node }} (macOS) + steps: + - name: Checkout Commit + uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Run tests + run: npm run ci:test:only + env: + CI: true + windows: - runs-on: windows-2019 + runs-on: windows-latest strategy: matrix: node: ['10', '16'] diff --git a/rollup.config.ts b/rollup.config.ts index fab7ed50e45..3273078b6bf 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -70,7 +70,10 @@ const nodePlugins = [ json(), conditionalFsEventsImport(), string({ include: '**/*.md' }), - commonjs({ include: 'node_modules/**' }), + commonjs({ + ignoreTryCatch: false, + include: 'node_modules/**' + }), typescript() ]; diff --git a/src/watch/fsevents-importer.ts b/src/watch/fsevents-importer.ts index b8a772da133..34e76ac5a90 100644 --- a/src/watch/fsevents-importer.ts +++ b/src/watch/fsevents-importer.ts @@ -1,16 +1,14 @@ let fsEvents: unknown; let fsEventsImportError: Error | undefined; -export function loadFsEvents(): Promise { +export async function loadFsEvents(): Promise { const moduleName = 'fsevents'; - return import(moduleName) - .then(namespace => { - fsEvents = namespace.default; - }) - .catch(err => { - fsEventsImportError = err; - }); + try { + ({ default: fsEvents } = await import(moduleName)); + } catch (err: any) { + fsEventsImportError = err; + } } // A call to this function will be injected into the chokidar code