mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Add a new compiler option moduleSuffixes to expand the node module resolver's search algorithm (#48189)
* Add moduleSuffixes compiler option and related tests. Update baselines for compiler options tests. * Add a flag to the command-line parser which allows "list" params to preserve "falsy" values such as empty strings. Falsy values are normally stripped out. * Add tests. Rework resolver logic to only run module-suffix code when needed. * PR feedback * Add test * Remove unnecessary conditional.
This commit is contained in:
@@ -420,6 +420,70 @@ namespace ts {
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty string option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [".ios", ""]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [".ios", ""]
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty string option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [""]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [""]
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert trailing-whitespace string option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [" "]
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: [" "]
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert empty option of moduleSuffixes to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: []
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
moduleSuffixes: []
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Convert incorrectly format tsconfig.json to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user