Skip to content

[INT-1] visual-snapshots: do not emit test files to build directory #202

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

Merged
merged 3 commits into from
Mar 12, 2025
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
679 changes: 638 additions & 41 deletions visual-js/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion visual-js/visual-snapshots/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
project: './tsconfig.test.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
Expand Down
1 change: 1 addition & 0 deletions visual-js/visual-snapshots/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build/
lib/
coverage/
.parent/
*.tsbuildinfo
4 changes: 2 additions & 2 deletions visual-js/visual-snapshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ yarn run build
Execute:

```sh
node lib/src/index.js pdf [params]
node lib/index.js pdf [params]
```

Run tests:
Expand All @@ -36,5 +36,5 @@ yarn run test

## Reusing pdf conversion code

While it is possible to use `VisualSnapshotsApi` outside this package, please bear in mind it can only be used with ESM modules.
While it is possible to use `VisualSnapshotsApi` outside this package, please bear in mind it can only be used with ESM modules.
CommonJS modules are not supported.
1 change: 1 addition & 0 deletions visual-js/visual-snapshots/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
'ts-jest',
{
useESM: true,
tsconfig: 'tsconfig.test.json'
},
],
},
Expand Down
9 changes: 5 additions & 4 deletions visual-js/visual-snapshots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "@saucelabs/visual-snapshots",
"description": "CLI which generates Visual snapshots from a data source such as pdf",
"version": "0.1.0",
"main": "./lib/src/index.js",
"main": "./lib/index.js",
"license": "MIT",
"bin": "./lib/src/index.js",
"bin": "./lib/index.js",
"files": [
"lib",
"README.md"
Expand All @@ -20,8 +20,8 @@
"pdf"
],
"scripts": {
"build": "tsc",
"watch": "tsc-watch --declaration -p .",
"build": "rimraf *.tsbuildinfo && tsc -b tsconfig.json",
"watch": "rimraf *.tsbuildinfo && tsc -b tsconfig.json -w",
"lint": "eslint \"{src,test}/**/*.ts\"",
"lint-fix": "eslint \"{src,test}/**/*.ts\" --fix",
"test": "jest",
Expand All @@ -40,6 +40,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jest": "29.7.0",
"prettier": "^2.8.8",
"rimraf": "^6.0.1",
"ts-jest": "29.2.5",
"typescript": "^5.0.4",
"typescript-eslint": "8.24.0"
Expand Down
27 changes: 10 additions & 17 deletions visual-js/visual-snapshots/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
// Builds source files and typechecks test files.
{
"compilerOptions": {
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
"module": "NodeNext", /* Specify what module code is generated. */
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
"outDir": "./lib", /* Specify an output folder for all emitted files. */
"removeComments": true, /* Disable emitting comments. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
"files": [],
"references": [
{
"path": "./tsconfig.src.json"
},
{
"path": "./tsconfig.test.json"
}
]
}
21 changes: 21 additions & 0 deletions visual-js/visual-snapshots/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
"module": "NodeNext", /* Specify what module code is generated. */
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
"outDir": "./lib", /* Specify an output folder for all emitted files. */
"removeComments": true, /* Disable emitting comments. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"tsBuildInfoFile": "./tsconfig.src.tsbuildinfo"
},
"include": ["./src"]
}
8 changes: 8 additions & 0 deletions visual-js/visual-snapshots/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.src.json",
"compilerOptions": {
"noEmit": true, // Do not emit built test files, only typecheck them
"composite": true // Required for reference in tsconfig.build.json
},
"include": ["./src", "./test"]
}
Loading