mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-16 01:26:16 -08:00
test(chapter): PKG-CHAPTER-02 cover behavior and optional factory types
This commit is contained in:
1 parent
701749520b
commit
12b047f9a6
17 files changed
+624
-15
No files matched your search
@@ -35,3 +35,14 @@ test('Browser implementation configuration catches source errors without emittin
|
||||
fs.rmSync(directory, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
test('Chapter optional factory parameters preserve strict update and data types in new and old compilers', () => {
|
||||
const source = fs.readFileSync(path.join(refactorDir, '../test/types/chapter-options.ts'), 'utf8')
|
||||
for (const mode of ['node10-commonjs', 'nodenext-cjs', 'bundler-esm']) {
|
||||
assert.deepEqual(checkConsumer(ts, mode, source), [])
|
||||
}
|
||||
assert.deepEqual(checkConsumer(compat, 'node10-commonjs', source), [])
|
||||
const unguarded = source.replaceAll(/\/\/ @ts-expect-error[^\n]*\n/g, '')
|
||||
const diagnostics = checkConsumer(ts, 'bundler-esm', unguarded)
|
||||
assert.equal(diagnostics.length, 3, 'Invalid update, title and null option must each fail')
|
||||
})
|
||||
Reference in new issue
Block a user