Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KostkaBrukowa committed Apr 26, 2024
1 parent fadba6a commit f525fd8
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 64 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,16 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
typescript_version: [ 5.2.2]
os: [ubuntu-latest, windows-latest]
typescript_version: [4.x, 5.2.2, 5.4.5]

steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '20.11.0'
node-version: '20.x'
- run: npm i
- run: npm i -D typescript@${{ matrix.typescript_version }}
- run: npm run build
- run: npm run test
- uses: actions/upload-artifact@v4
if: ${{ success() || failure() }}
with:
name: logs
path: e2e/**/ts.log

14 changes: 7 additions & 7 deletions e2e/plugin/multipleFile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { fixtureWithDefaultConfig } from '../fixtures/paths';
describe('multiple file diagnostics', () => {
it('should show errors only on file with strict comment', async () => {
// given
// const { projectPath, filePaths } = fixtureWithDefaultConfig;
// const fileList = [filePaths.strict, filePaths.ignored];
//
// // when
// const diagnostics = await getMultipleDiagnostics(projectPath, fileList);
const { projectPath, filePaths } = fixtureWithDefaultConfig;
const fileList = [filePaths.strict, filePaths.ignored];

// when
const diagnostics = await getMultipleDiagnostics(projectPath, fileList);

// then
expect([1]).toHaveLength(1);
expect([]).toHaveLength(0);
expect(diagnostics[0]).toHaveLength(1);
expect(diagnostics[1]).toHaveLength(0);
});
});
90 changes: 45 additions & 45 deletions e2e/plugin/singleFile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,49 @@ describe('single file diagnostics', () => {
expect(diagnostics).toHaveLength(1);
});

// it('should not enable strict mode in ignored file', async () => {
// // given
// const { projectPath, filePaths } = fixtureWithDefaultConfig;
//
// // when
// const diagnostics = await getDiagnostics(projectPath, filePaths.ignored);
//
// // then
// expect(diagnostics).toHaveLength(0);
// });
//
// it('should not enable strict mode when file is not on path', async () => {
// // given
// const { projectPath, filePaths } = fixtureWithPathConfig;
//
// // when
// const diagnostics = await getDiagnostics(projectPath, filePaths.excluded);
//
// // then
// expect(diagnostics).toHaveLength(0);
// });
//
// it('should enable strict mode when file is not on path and contains strict comment', async () => {
// // given
// const { projectPath, filePaths } = fixtureWithPathConfig;
//
// // when
// const diagnostics = await getDiagnostics(projectPath, filePaths.excludedWithStrictComment);
//
// // then
// expect(diagnostics).toHaveLength(1);
// });
//
// it('should enable strict mode with a relative path config', async () => {
// // given
// const { projectPath, filePaths } = fixtureWithPathConfig;
//
// // when
// const diagnosticsIncluded = await getDiagnostics(projectPath, filePaths.included);
// const diagnosticsExcluded = await getDiagnostics(projectPath, filePaths.excluded);
//
// // then
// expect(diagnosticsIncluded).toHaveLength(1);
// expect(diagnosticsExcluded).toHaveLength(0);
// });
it('should not enable strict mode in ignored file', async () => {
// given
const { projectPath, filePaths } = fixtureWithDefaultConfig;

// when
const diagnostics = await getDiagnostics(projectPath, filePaths.ignored);

// then
expect(diagnostics).toHaveLength(0);
});

it('should not enable strict mode when file is not on path', async () => {
// given
const { projectPath, filePaths } = fixtureWithPathConfig;

// when
const diagnostics = await getDiagnostics(projectPath, filePaths.excluded);

// then
expect(diagnostics).toHaveLength(0);
});

it('should enable strict mode when file is not on path and contains strict comment', async () => {
// given
const { projectPath, filePaths } = fixtureWithPathConfig;

// when
const diagnostics = await getDiagnostics(projectPath, filePaths.excludedWithStrictComment);

// then
expect(diagnostics).toHaveLength(1);
});

it('should enable strict mode with a relative path config', async () => {
// given
const { projectPath, filePaths } = fixtureWithPathConfig;

// when
const diagnosticsIncluded = await getDiagnostics(projectPath, filePaths.included);
const diagnosticsExcluded = await getDiagnostics(projectPath, filePaths.excluded);

// then
expect(diagnosticsIncluded).toHaveLength(1);
expect(diagnosticsExcluded).toHaveLength(0);
});
});
2 changes: 1 addition & 1 deletion e2e/plugin/utils/TSServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class TSServer {
const server = fork(tsserverPath, {
stdio: ['pipe', 'pipe', 'pipe', 'ipc'],
cwd: projectPath,
env: { TSS_LOG: '-logToFile true -file ./ts.log -level verbose' }, // creates tsserver log from tests
// env: { TSS_LOG: '-logToFile true -file ./ts.log -level verbose' }, // creates tsserver log from tests
});
this._exitPromise = new Promise((resolve, reject) => {
server.on('exit', (code: string) => resolve(code));
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-strict-plugin",
"version": "2.4.1",
"version": "2.4.2",
"description": "Typescript tools that help with migration to the strict mode",
"author": "Allegro",
"contributors": [
Expand Down Expand Up @@ -39,7 +39,7 @@
},
"jest": {
"preset": "ts-jest",
"testTimeout": 15000,
"testTimeout": 20000,
"roots": [
"src",
"e2e"
Expand Down

0 comments on commit f525fd8

Please sign in to comment.