Skip to content

Commit

Permalink
Move sku-init test, run sku-init test separately
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed May 7, 2024
1 parent bf16a84 commit daa81b6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Expand Up @@ -74,4 +74,4 @@ jobs:
key: jest-${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }}

- name: Test
run: pnpm run test --maxWorkers=2
run: pnpm run test
Expand Up @@ -4,7 +4,7 @@ const { promisify } = require('node:util');
const exec = promisify(require('node:child_process').exec);
const { runSkuScriptInDir } = require('@sku-private/test-utils');

const fixtureDirectory = path.join(__dirname, '../fixtures/sku-init');
const fixtureDirectory = __dirname;
const projectName = 'new-project';
const projectDirectory = path.join(fixtureDirectory, projectName);

Expand All @@ -20,6 +20,7 @@ describe('sku init', () => {
"Running 'pnpm install' to clean up lockfile after sku-init test...",
);
await exec('pnpm install');
console.log('Cleanup complete');
});

it(
Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Expand Up @@ -3,6 +3,7 @@ module.exports = {
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
maxWorkers: process.env.CI ? 2 : undefined,
preset: 'jest-puppeteer',
setupFilesAfterEnv: ['<rootDir>/test-utils/jestSetup.ts'],
snapshotSerializers: [
Expand All @@ -13,7 +14,7 @@ module.exports = {
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/packages/sku/scripts/test.js',
'<rootDir>/fixtures/.*/src',
'<rootDir>/fixtures/.*',
],
watchPlugins: [
'jest-watch-typeahead/filename',
Expand Down
11 changes: 11 additions & 0 deletions jest.config.sku-init.js
@@ -0,0 +1,11 @@
const {
testPathIgnorePatterns: _testPathIgnorePatterns,
...baseJestConfig
} = require('./jest.config');

/** @type {import('jest').Config} */
module.exports = {
...baseJestConfig,
// Ensure that the only test that can be run with this config is sku-init.test.js
testRegex: 'sku-init\\.test\\.js$',
};
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -10,7 +10,9 @@
"lint:prettier": "prettier --cache --list-different '**/*.{js,ts,tsx,md,less,css}'",
"lint:tsc": "tsc",
"check": "pnpm install --frozen-lockfile && echo 'Ignore paths from lint-staged'",
"test": "SKU_TELEMETRY=false SKU_DISABLE_CACHE=true OPEN_TAB=false jest --verbose",
"test": "pnpm run test:rest && pnpm run test:sku-init",
"test:rest": "SKU_TELEMETRY=false SKU_DISABLE_CACHE=true OPEN_TAB=false jest --verbose",
"test:sku-init": "SKU_TELEMETRY=false SKU_DISABLE_CACHE=true OPEN_TAB=false jest --verbose --config=jest.config.sku-init.js",
"setup-test-hosts": "node test-utils/setupTestHosts",
"format": "prettier --cache --write '**/*.{js,ts,tsx,md,less,css}' && eslint --cache --fix .",
"deploy-docs": "pnpm run --filter @sku-private/docs deploy",
Expand Down
2 changes: 1 addition & 1 deletion tests/braid-design-system.test.js
Expand Up @@ -72,7 +72,7 @@ describe('braid-design-system', () => {
});
});

it('should handle braid-design-system in tests', async () => {
it.only('should handle braid-design-system in tests', async () => {
const { child } = await runSkuScriptInDir('test', appDir);
expect(child.exitCode).toEqual(0);
});
Expand Down

0 comments on commit daa81b6

Please sign in to comment.