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

fix: respect prototypes when mocking #953

Merged
merged 4 commits into from
May 20, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
/tap-snapshots
/.tap
/src/*/.tap
/src/test/test-built/node_modules
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"type": "module",
"prettier": {
"experimentalTernaries": true,
"semi": false,
"printWidth": 70,
"tabWidth": 2,
Expand Down Expand Up @@ -68,7 +69,7 @@
"patch-console": "^2.0.0",
"path-scurry": "^1.9.2",
"polite-json": "^4.0.1",
"prettier": "^2.8.7",
"prettier": "^3.2.5",
"prismjs": "^1.29.0",
"prismjs-terminal": "^1.2.3",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/after-each/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class AfterEach {
loop(
this.#parentOnAfterEach.map(f => () => f(this.#t.t)),
cb,
onerr
onerr,
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/after-each/test/import-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
dependencies,
peerDependencies,
} = JSON.parse(
await readFile(resolve(src, '../package.json'), 'utf8')
await readFile(resolve(src, '../package.json'), 'utf8'),
) as {
name: string
dependencies?: Record<string, string>
Expand Down Expand Up @@ -79,7 +79,7 @@ if (
deps,
{ [dep]: String },
'loaded, should be declared: ' + dep,
{ paths: f }
{ paths: f },
)
}
}
4 changes: 2 additions & 2 deletions src/after-each/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ t.test('rejected ae fails relevant test', async t => {
`
if (tt.name === 'fail') throw new Error('nope')
------------------------------------^
`
`,
)
t.strictSame(log, [
['child main'],
Expand Down Expand Up @@ -205,7 +205,7 @@ t.test('throwing ae fails relevant test', async t => {
`
if (tt.name === 'fail') throw new Error('nope')
------------------------------------^
`
`,
)
t.strictSame(log, [
['child main'],
Expand Down
4 changes: 2 additions & 2 deletions src/after/test/import-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
dependencies,
peerDependencies,
} = JSON.parse(
await readFile(resolve(src, '../package.json'), 'utf8')
await readFile(resolve(src, '../package.json'), 'utf8'),
) as {
name: string
dependencies?: Record<string, string>
Expand Down Expand Up @@ -79,7 +79,7 @@ if (
deps,
{ [dep]: String },
'loaded, should be declared: ' + dep,
{ paths: f }
{ paths: f },
)
}
}
6 changes: 3 additions & 3 deletions src/after/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ t.cleanSnapshot = s =>
.replace(/# time=[0-9\.]+m?s$/gm, '# time={TIME}')
.replace(
/stack: [|>]-?\n(.|\n)+\n at:/g,
'stack: {STACK}\n at:'
'stack: {STACK}\n at:',
)
.replace(/lineNumber: \d+/, 'lineNumber: ##')
.replace(/columnNumber: \d+/, 'columnNumber: ##')
Expand Down Expand Up @@ -68,12 +68,12 @@ t.test('handle async teardown', async t => {
t.equal(
teardownStarted,
true,
'ran teardown, but not done with it yet'
'ran teardown, but not done with it yet',
)
t.equal(
teardownDone,
false,
'ran teardown, but not done with it yet'
'ran teardown, but not done with it yet',
)
t.matchSnapshot(await output, 'test output')
t.equal(teardownDone, true, 'finished teardown')
Expand Down
Loading
Loading