Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split typechecking from tests #731

Merged
merged 10 commits into from
Jun 21, 2024
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
80 changes: 42 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,45 @@ env:
CI: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- run: yarn install --frozen-lockfile
- run: yarn lint


type-tests:
name: "Type Tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- run: yarn install --frozen-lockfile
- run: "yarn build"
- run: "yarn workspaces run test:typecheck"
- run: "yarn workspaces run test:tsc"

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Locate Yarn Cache
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn install --frozen-lockfile
# - name: Lint
# run: yarn lint
cache: yarn
- run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Run Tests
Expand Down Expand Up @@ -88,14 +104,12 @@ jobs:
name: Test Floating Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Dependencies
run: yarn install --no-lockfile
cache: yarn
- run: yarn install --no-lockfile
- name: Build
run: yarn build
- name: Run Tests
Expand All @@ -107,23 +121,13 @@ jobs:
name: Test TypeScript Nightly
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Locate Yarn Cache
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn add --dev -W typescript@next
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn add --dev -W typescript@next
- name: Build
run: yarn build
- name: Run Tests
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"scripts": {
"lint": "yarn lint:scripts && yarn lint:formatting",
"lint:fix": "yarn lint:scripts --fix && yarn prettier --write .",
"lint:scripts": "yarn eslint --max-warnings 0 --cache .",
"lint:scripts": "yarn eslint .",
"lint:formatting": "yarn prettier --check .",
"test": "yarn workspaces run test",
"test:typecheck": "yarn workspaces run test:typecheck",
"build": "tsc --build",
"release-it": "echo \"Running release-it via yarn breaks publishing! Use npx or a Volta global installation.\""
},
Expand All @@ -30,7 +31,7 @@
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"eslint": "^8.27.0",
"prettier": "^2.1.1",
"prettier": "^3.3.2",
"release-it": "^15.5.0",
"typescript": "~5.3.0"
},
Expand Down
18 changes: 9 additions & 9 deletions packages/core/__tests__/cli/build-watch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe.skip('CLI: watched build mode typechecking', () => {
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);

expect(output).toMatch('Found 1 error.');
Expand Down Expand Up @@ -154,7 +154,7 @@ describe.skip('CLI: watched build mode typechecking', () => {
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);

expect(output).toMatch('Found 1 error.');
Expand Down Expand Up @@ -349,14 +349,14 @@ describe.skip('CLI: watched build mode typechecking', () => {

projects.main.write(
INPUT_SFC,
mainCode.replace('{{this.startupTime}}', '{{this.startupTime}')
mainCode.replace('{{this.startupTime}}', '{{this.startupTime}'),
);

output = await watch.awaitOutput('Parse error');
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);
expect(error).toMatchInlineSnapshot(`
"index.gts:14:32 - error TS0: Parse error on line 3:
Expand Down Expand Up @@ -392,7 +392,7 @@ describe.skip('CLI: watched build mode typechecking', () => {
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`;${os.EOL}`) + 1
stripped.lastIndexOf(`;${os.EOL}`) + 1,
);
expect(error).toMatchInlineSnapshot(`
"index.gts:3:28 - error TS0: Unclosed element \`C\`:
Expand Down Expand Up @@ -430,7 +430,7 @@ describe.skip('CLI: watched build mode typechecking', () => {
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);
expect(error).toMatchInlineSnapshot(`
"index.gts:3:31 - error TS0: Parse error on line 1:
Expand Down Expand Up @@ -468,7 +468,7 @@ describe.skip('CLI: watched build mode typechecking', () => {
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);
expect(error).toMatchInlineSnapshot(`
"index.gts:15:5 - error TS2554: Expected 0 arguments, but got 1.
Expand Down Expand Up @@ -501,7 +501,7 @@ describe.skip('CLI: watched build mode typechecking', () => {
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);
expect(error).toMatchInlineSnapshot(`
"index.gts:3:28 - error TS2554: Expected 0 arguments, but got 1.
Expand Down Expand Up @@ -534,7 +534,7 @@ describe.skip('CLI: watched build mode typechecking', () => {
let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);
expect(error).toMatchInlineSnapshot(`
"index.gts:3:27 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
Expand Down
46 changes: 23 additions & 23 deletions packages/core/__tests__/cli/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await project.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`,
);
expect(buildResult.stderr).toEqual('');
});
Expand All @@ -1321,7 +1321,7 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await project.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${project.filePath('tsconfig.json')}' is up to date`
`Project '${project.filePath('tsconfig.json')}' is up to date`,
);
expect(buildResult.stderr).toEqual('');
});
Expand Down Expand Up @@ -1350,7 +1350,7 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await project.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`,
);
expect(buildResult.stderr).toEqual('');
});
Expand Down Expand Up @@ -1391,7 +1391,7 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await project.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`,
);
expect(buildResult.stderr).toEqual('');
});
Expand All @@ -1405,7 +1405,7 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await project.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${project.filePath('tsconfig.json')}' is up to date`
`Project '${project.filePath('tsconfig.json')}' is up to date`,
);
expect(buildResult.stderr).toEqual('');
});
Expand All @@ -1429,7 +1429,7 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await project.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`,
);
expect(buildResult.stderr).toEqual('');
});
Expand All @@ -1445,7 +1445,7 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await project.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`
`A non-dry build would build project '${project.filePath('tsconfig.json')}'`,
);
expect(buildResult.stderr).toEqual('');
}, 2_000_000);
Expand Down Expand Up @@ -1502,16 +1502,16 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await projects.root.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.children.a.filePath('tsconfig.json')}'`
`A non-dry build would build project '${projects.children.a.filePath('tsconfig.json')}'`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.children.b.filePath('tsconfig.json')}'`
`A non-dry build would build project '${projects.children.b.filePath('tsconfig.json')}'`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.children.c.filePath('tsconfig.json')}'`
`A non-dry build would build project '${projects.children.c.filePath('tsconfig.json')}'`,
);
expect(buildResult.stderr).toEqual('');
});
Expand All @@ -1525,16 +1525,16 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await projects.root.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.main.filePath('tsconfig.json')}' is up to date`
`Project '${projects.main.filePath('tsconfig.json')}' is up to date`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.a.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.a.filePath('tsconfig.json')}' is up to date`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.b.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.b.filePath('tsconfig.json')}' is up to date`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.c.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.c.filePath('tsconfig.json')}' is up to date`,
);
expect(buildResult.stderr).toEqual('');
});
Expand Down Expand Up @@ -1564,16 +1564,16 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await projects.root.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.a.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.a.filePath('tsconfig.json')}' is up to date`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.b.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.b.filePath('tsconfig.json')}' is up to date`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.c.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.c.filePath('tsconfig.json')}' is up to date`,
);
expect(buildResult.stderr).toEqual('');
});
Expand All @@ -1589,16 +1589,16 @@ describe.skip('CLI: --build --dry', () => {
let buildResult = await projects.root.build({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.children.a.filePath('tsconfig.json')}'`
`A non-dry build would build project '${projects.children.a.filePath('tsconfig.json')}'`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.b.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.b.filePath('tsconfig.json')}' is up to date`,
);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.children.c.filePath('tsconfig.json')}' is up to date`
`Project '${projects.children.c.filePath('tsconfig.json')}' is up to date`,
);
expect(buildResult.stderr).toEqual('');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/core/__tests__/cli/check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ describe('CLI: single-pass typechecking', () => {
'my-component.gts',
stripIndent`
export let x: string = 123;
`
`,
);

let checkResult = await project.check({ reject: false });
Expand Down
Loading
Loading