Skip to content

Commit

Permalink
fix: rename typescript configuration option to honor the readme docs
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ohara authored and kaisermann committed Aug 8, 2019
1 parent 260a511 commit 67f2137
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/transformers/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ function compileFileFromMemory(compilerOptions, { filename, content }) {

module.exports = ({ content, filename, options }) => {
const fileDirectory = options.tsconfigDirectory || dirname(filename)
const tsconfigPath =
options.tsconfigPath || ts.findConfigFile(fileDirectory, ts.sys.fileExists)
const basePath = tsconfigPath ? dirname(tsconfigPath) : process.cwd()
const tsconfigFile =
options.tsconfigFile || ts.findConfigFile(fileDirectory, ts.sys.fileExists)
const basePath = tsconfigFile ? dirname(tsconfigFile) : process.cwd()

let compilerOptionsJSON = Object.assign(
// default options
Expand All @@ -169,8 +169,8 @@ module.exports = ({ content, filename, options }) => {
options.compilerOptions,
)

if (tsconfigPath) {
const { error, config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile)
if (tsconfigFile) {
const { error, config } = ts.readConfigFile(tsconfigFile, ts.sys.readFile)
if (error) {
throw new Error(formatDiagnostics(error, basePath))
}
Expand Down
8 changes: 4 additions & 4 deletions test/transformers/typescript.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ describe('transformer - typescript', () => {
expect(preprocessed.toString()).toContain(EXPECTED_SCRIPT)
})

it('should work with tsconfigPath', async () => {
it('should work with tsconfigFile', async () => {
const opts = getAutoPreprocess({
typescript: {
tsconfigPath: './test/fixtures/tsconfig.json',
tsconfigFile: './test/fixtures/tsconfig.json',
},
})
const preprocessed = await preprocess(template, opts)
Expand All @@ -55,7 +55,7 @@ describe('transformer - typescript', () => {
it('should report config syntactic errors in tsconfig file', () => {
const opts = getAutoPreprocess({
typescript: {
tsconfigPath: './test/fixtures/tsconfig.syntactic.json',
tsconfigFile: './test/fixtures/tsconfig.syntactic.json',
},
})
return expect(preprocess(template, opts)).rejects.toThrow('TS1005')
Expand All @@ -64,7 +64,7 @@ describe('transformer - typescript', () => {
it('should report config semantic errors in tsconfig file', () => {
const opts = getAutoPreprocess({
typescript: {
tsconfigPath: './test/fixtures/tsconfig.semantic.json',
tsconfigFile: './test/fixtures/tsconfig.semantic.json',
},
})
return expect(preprocess(template, opts)).rejects.toThrow('TS6046')
Expand Down

0 comments on commit 67f2137

Please sign in to comment.