-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 修正轉換時
constructor
變成 function Object() { [native code] }
的 BUG
- Loading branch information
1 parent
41b5d76
commit 731e5fd
Showing
7 changed files
with
594 additions
and
64 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
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { readFile } from 'fs-extra'; | ||
import { join } from 'upath2'; | ||
import { handleText } from '../../lib/handleText'; | ||
|
||
if (typeof jest !== 'undefined') | ||
{ | ||
jest.setTimeout(60 * 1000); | ||
} | ||
|
||
export async function handleFile(file: string, cwd: string) | ||
{ | ||
const text = await readFile(join(cwd, file)).then(m => m.toString()); | ||
|
||
const actual = await handleText(text, { | ||
file, | ||
}); | ||
|
||
return { | ||
text, | ||
actual, | ||
} | ||
} |
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,44 @@ | ||
//@noUnusedParameters:false | ||
|
||
import { basename, extname } from 'path'; | ||
import { handlePropertiesFile, stringifyProperties } from '../lib/build/properties-replace'; | ||
import { __plugin_downloaded_dir_unzip } from '../lib/const'; | ||
import { join } from 'upath2'; | ||
import { handleFile } from './lib/handle.file'; | ||
|
||
describe(`messages/AnalysisBundle.properties`, () => | ||
{ | ||
const file = `messages/AnalysisBundle.properties`; | ||
const cwd = join(__plugin_downloaded_dir_unzip, 'zh'); | ||
|
||
test(`handlePropertiesFile`, () => | ||
{ | ||
|
||
let { | ||
dp, | ||
} = handlePropertiesFile(file, cwd); | ||
|
||
const actual = stringifyProperties(dp); | ||
|
||
_chk(actual); | ||
|
||
}); | ||
|
||
test(`handleFile`, async () => | ||
{ | ||
|
||
let { actual } = await handleFile(file, cwd); | ||
|
||
_chk(actual); | ||
|
||
}); | ||
|
||
function _chk(actual: string) | ||
{ | ||
expect(actual).toContain(`inspection.dead.code.problem.synopsis29.constructor`); | ||
expect(actual).not.toContain(`[native code]`); | ||
expect(actual).toMatchSnapshot(); | ||
} | ||
|
||
}) | ||
|
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