-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
171 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
process.env.NODE_ENV = 'test' | ||
module.exports = { | ||
spec: 'src/**/*.test.ts', | ||
require: 'ts-node/register/transpile-only', | ||
watchExtensions: 'ts', | ||
extension: 'ts', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "example-node-runner", | ||
"private": true, | ||
"version": "1.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"start": "ts-node -T ./src/index.ts", | ||
"format": "biome format .", | ||
"format:fix": "biome format --write .", | ||
"lint": "biome check ./src", | ||
"lint:fix": "biome check --apply ./src", | ||
"typecheck": "tsc --noEmit", | ||
"test": "node --test --loader ts-node/esm src/*.test.ts", | ||
"test:fix": "pnpm lint:fix && pnpm format:fix && pnpm test && pnpm typecheck" | ||
}, | ||
"dependencies": { | ||
"earl": "workspace:^1.2.1", | ||
"example-plugin": "workspace:^1.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { describe, it } from 'node:test' | ||
import { expect } from 'earl' | ||
|
||
describe('basics', () => { | ||
it('works', (ctx) => { | ||
class Person { | ||
constructor(readonly name: string) {} | ||
} | ||
|
||
const response = { | ||
trimmed: true, | ||
timestamp: '12345', | ||
name: 'Alice Duck', | ||
age: 15, | ||
nested: { | ||
b: new Person('Jack'), | ||
deep: { | ||
nested: true, | ||
}, | ||
}, | ||
} | ||
|
||
expect(response).toEqual({ | ||
trimmed: true, | ||
timestamp: expect.anything(), | ||
name: expect.regex(/[Dd]uck/), | ||
age: expect.a(Number), | ||
nested: { | ||
b: expect.a(Person), | ||
deep: expect.a(Object), | ||
}, | ||
}) | ||
|
||
expect(true).toEqual(true) | ||
|
||
expect(response).toMatchSnapshot(ctx) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// works 1 | ||
|
||
{ | ||
age: 15 | ||
name: "Alice Duck" | ||
nested: { | ||
b: Person { | ||
name: "Jack" | ||
} | ||
deep: { | ||
nested: true | ||
} | ||
} | ||
timestamp: "12345" | ||
trimmed: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { describe, it } from 'node:test' | ||
import { expect } from 'earl' | ||
|
||
describe('snapshots', () => { | ||
it('work', (ctx) => { | ||
expect({ very: { nested: { wow: 'wow' } } }).toMatchSnapshot(ctx) | ||
expect('totally different thing').toMatchSnapshot(ctx) | ||
}) | ||
}) |
13 changes: 13 additions & 0 deletions
13
examples/example-node-runner/src/snapshots.test.ts.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// work 1 | ||
|
||
{ | ||
very: { | ||
nested: { | ||
wow: "wow" | ||
} | ||
} | ||
} | ||
|
||
// work 2 | ||
|
||
"totally different thing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["ESNext"], | ||
"target": "ESNext", | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"esModuleInterop": true, | ||
"verbatimModuleSyntax": true, | ||
"strict": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.