Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
test: update all tests because of prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimarimon committed Aug 13, 2023
1 parent f661c9e commit a357415
Show file tree
Hide file tree
Showing 140 changed files with 861 additions and 436 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/bazel-out
/e2e/out
packages/*/dist/
packages/*/.tsbuildinfo
packages/*/package-lock.json

# Node
Expand Down
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/bazel-out
/e2e/out
packages/*/dist/
packages/*/.tsbuildinfo
packages/*/package-lock.json

# Node
Expand Down Expand Up @@ -51,8 +50,8 @@ trace.zip

.env
_site/
tests/**/*.json
docs/**/*.css
docs/**/*.njk
scripts/**/*.hbs

docs/api-reference/**/*.njk
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
"doc:clear": "rm -rf ./_site",
"doc:build:11ty": "NODE_ENV=production eleventy --config=.eleventy.cjs",
"doc:start:11ty": "eleventy --serve --config=.eleventy.cjs",
"doc:api": "node scripts/docs/generate-api-reference.mjs",
"doc:api": "node scripts/docs/generate-api-reference.js",
"ts:build": "tsc --build packages/*/tsconfig.json",
"ts:reset": "rm -rf ./packages/*/.tsbuildinfo",
"ts:clear": "rm -rf ./packages/*/dist",
"publish": "npm publish --access public --workspaces",
"test": "vitest run --config vitest.config.ts",
"test:update": "UPDATE_SNAPSHOTS=true vitest run --config vitest.config.ts",
"coverage": "vitest run --coverage --config vitest.config.ts",
"prepare": "./scripts/prepare.sh",
"prepare": "node scripts/prepare.js",
"upgrade": "rm -rf node_modules package-lock.json && npm i",
"bump": "npx ncu -u -x typescript",
"bump:pkg": "node ./scripts/bump.mjs",
"bump:pkg": "node scripts/bump.js",
"lint": "eslint \"**/*.ts\" --max-warnings 0",
"lint:fix": "eslint \"**/*.ts\" --fix --cache --max-warnings 0",
"prettier": "prettier --write --ignore-unknown"
Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions scripts/prepare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as cp from 'child_process';
import * as fs from 'fs';

// Execute Git command
const git = args => cp.spawnSync('git', args, { stdio: 'inherit' });

// Ensure that we're inside a Git repository
// If git command is not found, status is null and we should return
// That's why status value needs to be checked explicitly
if (git(['rev-parse']).status !== 0) {
throw new Error('git command not found, skipping install');
}

// Ensure that cwd is git top level
if (!fs.existsSync('.git')) {
throw new Error('.git can\'t be found');
}

const { error } = git(['config', 'core.hooksPath', '.hooks']);

if (error) {
throw error;
}
12 changes: 0 additions & 12 deletions scripts/prepare.sh

This file was deleted.

12 changes: 6 additions & 6 deletions tests/class/abstract/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"text": "number",
"kind": "Primitive"
},
"line": 3,
"line": 2,
"default": 4
},
{
Expand All @@ -27,7 +27,7 @@
"text": "number",
"kind": "Primitive"
},
"line": 5,
"line": 4,
"abstract": true
}
],
Expand All @@ -43,23 +43,23 @@
"kind": "Primitive"
}
},
"line": 7,
"line": 6,
"parameters": [
{
"name": "x",
"type": {
"text": "number",
"kind": "Primitive"
},
"line": 7
"line": 6
},
{
"name": "y",
"type": {
"text": "number",
"kind": "Primitive"
},
"line": 7
"line": 6
}
]
}
Expand All @@ -76,4 +76,4 @@
}
]
}
]
]
12 changes: 9 additions & 3 deletions tests/class/abstract/test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { describe, expect, it } from 'vitest';
import { getTestResult } from '../../utils.js';
import { getTestResult, test, updateExpectedOutput } from '../../utils.js';
import { describe, expect } from 'vitest';

const category = 'class';
const subcategory = 'abstract';
const { actual, expected } = await getTestResult({ category, subcategory });

describe(`${category}/${subcategory}`, () => {
it('should reflect the expected modules', () => {
test('should reflect the expected modules', ({ update }) => {
const result = actual.map(m => m.serialize());

if (update) {
updateExpectedOutput(result, category, subcategory);
return;
}

expect(result).to.deep.equal(expected);
});
});
22 changes: 11 additions & 11 deletions tests/class/basic/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@
}
}
},
"line": 18,
"line": 17,
"parameters": [
{
"name": "x",
"type": {
"text": "number",
"kind": "Primitive"
},
"line": 18
"line": 17
},
{
"name": "y",
"type": {
"text": "number",
"kind": "Primitive"
},
"line": 18
"line": 17
},
{
"name": "message",
"type": {
"text": "string",
"kind": "Primitive"
},
"line": 18
"line": 17
}
]
}
Expand All @@ -63,7 +63,7 @@
"text": "number",
"kind": "Primitive"
},
"line": 8,
"line": 7,
"optional": true
},
{
Expand All @@ -73,7 +73,7 @@
"text": "string",
"kind": "Primitive"
},
"line": 12,
"line": 11,
"readOnly": true
}
],
Expand All @@ -85,7 +85,7 @@
"text": "\"Hello World\"",
"kind": "Literal"
},
"line": 6,
"line": 5,
"default": "'Hello World'",
"static": true,
"readOnly": true
Expand All @@ -103,15 +103,15 @@
"kind": "Primitive"
}
},
"line": 24,
"line": 23,
"parameters": [
{
"name": "message",
"type": {
"text": "string",
"kind": "Primitive"
},
"line": 24
"line": 23
}
]
}
Expand All @@ -129,7 +129,7 @@
"kind": "Primitive"
}
},
"line": 28
"line": 27
}
]
}
Expand All @@ -143,4 +143,4 @@
}
]
}
]
]
12 changes: 9 additions & 3 deletions tests/class/basic/test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { describe, expect, it } from 'vitest';
import { getTestResult } from '../../utils.js';
import { getTestResult, test, updateExpectedOutput } from '../../utils.js';
import { describe, expect } from 'vitest';

const category = 'class';
const subcategory = 'basic';
const { actual, expected } = await getTestResult({ category, subcategory });

describe(`${category}/${subcategory}`, () => {
it('should reflect the expected modules', () => {
test('should reflect the expected modules', ({ update }) => {
const result = actual.map(m => m.serialize());

if (update) {
updateExpectedOutput(result, category, subcategory);
return;
}

expect(result).to.deep.equal(expected);
});
});
8 changes: 4 additions & 4 deletions tests/class/class-expressions/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"text": "string",
"kind": "Primitive"
},
"line": 6,
"line": 5,
"default": "'foo'"
}
]
},
{
"name": "bar",
"kind": "Class",
"line": 13,
"line": 11,
"jsDoc": [
{
"kind": "description",
Expand All @@ -45,7 +45,7 @@
"text": "string",
"kind": "Primitive"
},
"line": 15,
"line": 12,
"default": "'bar'"
}
]
Expand All @@ -62,4 +62,4 @@
}
]
}
]
]
12 changes: 9 additions & 3 deletions tests/class/class-expressions/test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { describe, expect, it } from 'vitest';
import { getTestResult } from '../../utils.js';
import { getTestResult, updateExpectedOutput, test } from '../../utils.js';
import { describe, expect } from 'vitest';

const category = 'class';
const subcategory = 'class-expressions';
const { actual, expected } = await getTestResult({ category, subcategory });

describe(`${category}/${subcategory}`, () => {
it('should reflect the expected modules', () => {
test('should reflect the expected modules', ({ update }) => {
const result = actual.map(m => m.serialize());

if (update) {
updateExpectedOutput(result, category, subcategory);
return;
}

expect(result).to.deep.equal(expected);
});
});
2 changes: 1 addition & 1 deletion tests/class/default-inheritance/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@
}
]
}
]
]
12 changes: 9 additions & 3 deletions tests/class/default-inheritance/test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { describe, expect, it } from 'vitest';
import { getTestResult } from '../../utils.js';
import { getTestResult, updateExpectedOutput, test } from '../../utils.js';
import { describe, expect } from 'vitest';

const category = 'class';
const subcategory = 'default-inheritance';
const { actual, expected } = await getTestResult({ category, subcategory });

describe(`${category}/${subcategory}`, () => {
it('should reflect the expected modules', () => {
test('should reflect the expected modules', ({ update }) => {
const result = actual.map(m => m.serialize());

if (update) {
updateExpectedOutput(result, category, subcategory);
return;
}

expect(result).to.deep.equal(expected);
});
});
Loading

0 comments on commit a357415

Please sign in to comment.