diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d58b6e5886..64eb7d531a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -48,41 +48,38 @@ jobs: key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }} - # TODO: Investigate [error]Process completed with exit code 1. - # test-unit: - # runs-on: ${{ matrix.os }} + test-unit: + runs-on: ${{ matrix.os }} - # strategy: - # matrix: - # os: [windows-latest] - # node: [12] + strategy: + matrix: + os: [windows-latest] + node: [12] - # env: - # NODE_OPTIONS: "--max_old_space_size=4096" + env: + NODE_OPTIONS: "--max_old_space_size=4096" - # steps: - # - uses: actions/setup-node@v1 - # with: - # node-version: ${{ matrix.node }} + steps: + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} - # - name: checkout - # uses: actions/checkout@master + - name: checkout + uses: actions/checkout@master - # - name: restore workspace cache - # uses: actions/cache@v1 - # with: - # path: ./**/node_modules - # key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }} + - name: restore workspace cache + uses: actions/cache@v2 + with: + path: | + node_modules + packages/*/node_modules + packages/*/dist + key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }} - # - name: test unit - # run: node node_modules/jest/bin/jest packages -i --coverage --verbose + - name: test unit + run: yarn test:unit --testPathIgnorePatterns=packages/cli - # - name: codecov - # uses: codecov/codecov-action@v1 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} - # flags: unittests - # needs: setup + needs: setup build: runs-on: ${{ matrix.os }} @@ -113,7 +110,7 @@ jobs: key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }} - name: build - run: yarn test:fixtures -i + run: yarn test:fixtures - name: cache fixtures uses: actions/cache@v2 @@ -157,5 +154,5 @@ jobs: key: ${{ matrix.os }}-node-v${{ matrix.node }}-fixtures-${{ github.sha }} - name: test dev - run: yarn test:dev -i + run: yarn test:dev needs: build diff --git a/packages/cli/test/unit/command.test.js b/packages/cli/test/unit/command.test.js index d15eec795c..2d98ebf78e 100644 --- a/packages/cli/test/unit/command.test.js +++ b/packages/cli/test/unit/command.test.js @@ -3,12 +3,16 @@ import { common, server } from '../../src/options' import * as utils from '../../src/utils/' import * as config from '../../src/utils/config' import * as constants from '../../src/utils/constants' -import { consola } from '../utils' +import { consola, localPath } from '../utils' jest.mock('@nuxt/core') jest.mock('@nuxt/builder') jest.mock('@nuxt/generator') +jest.mock(localPath('@nuxt/core')) +jest.mock(localPath('@nuxt/builder')) +jest.mock(localPath('@nuxt/generator')) + const allOptions = { ...common, ...server diff --git a/packages/cli/test/utils/index.js b/packages/cli/test/utils/index.js index f0ebe40a9b..38fbc86175 100644 --- a/packages/cli/test/utils/index.js +++ b/packages/cli/test/utils/index.js @@ -1,9 +1,14 @@ +import path from 'path' import consola from 'consola' + export * from './mocking' export { NuxtCommand } from '../../src' consola.mockTypes(() => jest.fn()) +const localPath = modulePath => path.resolve(process.cwd(), 'node_modules', modulePath) + export { - consola + consola, + localPath }