Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ Task functions can: return a Promise, call a `done` callback, or return a stream

- TypeScript target: `es2019`, module: `commonjs`, strict mode
- Prettier: 120 print width, single quotes, trailing commas, 2-space indent
- Tests: Jest with ts-jest, test files in `src/**/__tests__/*.(test|spec).ts`
- Tests:
- Jest with ts-jest
- Test files in `src/**/__tests__/*.(test|spec).ts`
- Functions such as `describe`, `it`, `expect` must be imported from `@jest/globals` (they are not implicitly available)
- Each package compiles to `lib/` directory

## CI / Release
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"node": ">=14"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@microsoft/api-extractor": "7.52.9",
"@types/fs-extra": "^11.0.0",
"@types/jest": "^29.4.0",
Expand Down
1 change: 1 addition & 0 deletions packages/just-scripts/src/__tests__/getMockScript.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect } from '@jest/globals';
import * as fs from 'fs';
import * as path from 'path';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { copyFilesToDestinationDirectory } from '../CopyInstruction';
import { normalize } from 'path';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, beforeEach, afterEach } from '@jest/globals';
import * as mockfs from 'mock-fs';
import * as path from 'path';
import * as fs from 'fs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, jest } from '@jest/globals';
import * as path from 'path';
import type { spawn } from '../../utils/exec';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest, beforeEach, afterEach, afterAll } from '@jest/globals';
import { fail } from 'assert';
import type { TaskFunction } from 'just-task';
import * as path from 'path';
Expand Down
3 changes: 2 additions & 1 deletion packages/just-scripts/src/tasks/__tests__/tscTask.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest, beforeEach, afterEach } from '@jest/globals';
import * as mockfs from 'mock-fs';
import { spawn } from '../../utils';
import { tscTask, tscWatchTask } from '../tscTask';
Expand All @@ -6,7 +7,7 @@ import { getNormalizedSpawnArgs } from './getNormalizedSpawnArgs';

// Jest will hoist these before the imports above, so these modules will be mocked first
jest.mock('../../utils/exec', () => {
const originalModule = jest.requireActual('../../utils/exec');
const originalModule = jest.requireActual('../../utils/exec') as typeof import('../../utils/exec');
return {
// Use real implementation of most exports
...originalModule,
Expand Down
1 change: 1 addition & 0 deletions packages/just-scripts/src/utils/__tests__/exec.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest, afterEach } from '@jest/globals';
import * as cp from 'child_process';
import * as path from 'path';
import { encodeArgs, spawn } from '../exec';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { mergePackageJson, _shouldUpdateDep } from '../mergePackageJson';
import { PackageJson } from '../../interfaces/PackageJson';

Expand Down
1 change: 1 addition & 0 deletions packages/just-scripts/src/utils/__tests__/paths.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, afterEach } from '@jest/globals';
import * as path from 'path';
import * as os from 'os';
import { paths } from '../paths';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, beforeEach, afterEach } from '@jest/globals';
import { readPackageJson } from '../readPackageJson';
import * as mockfs from 'mock-fs';

Expand Down
1 change: 1 addition & 0 deletions packages/just-task/src/__tests__/chain.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest } from '@jest/globals';
import { task } from '../task';
import { chain } from '../chain';
import { parallel } from '../undertaker';
Expand Down
1 change: 1 addition & 0 deletions packages/just-task/src/__tests__/logger.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest, beforeAll, beforeEach, afterAll } from '@jest/globals';
import { logger } from '../logger';
import chalk = require('chalk');

Expand Down
1 change: 1 addition & 0 deletions packages/just-task/src/__tests__/resolve.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest, afterEach, beforeEach } from '@jest/globals';
import * as path from 'path';
import {
_isFileNameLike,
Expand Down
1 change: 1 addition & 0 deletions packages/just-task/src/__tests__/task.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest, beforeAll, beforeEach, afterAll } from '@jest/globals';
import { task } from '../task';
import { parallel, undertaker } from '../undertaker';
import { logger } from '../logger';
Expand Down
3 changes: 2 additions & 1 deletion packages/just-task/src/__tests__/watch.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { watch } from '../watch';
import * as fs from 'fs';
import * as path from 'path';
Expand Down Expand Up @@ -25,7 +26,7 @@ describe('watch', () => {
done();
} catch (error) {
cleanup();
done(error);
done(error instanceof Error ? error : new Error(String(error)));
}
};

Expand Down
1 change: 1 addition & 0 deletions scripts/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).[jt]s'],
verbose: true,
injectGlobals: false,
transform: {
'^.+\\.tsx?$': [
'ts-jest',
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": false,
"types": ["node", "jest"]
"types": ["node"]
}
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
jest-mock "^29.7.0"
jest-util "^29.7.0"

"@jest/globals@^29.7.0":
"@jest/globals@^29.5.0", "@jest/globals@^29.7.0":
version "29.7.0"
resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d"
integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==
Expand Down
Loading