-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
5,885 additions
and
646 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
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 |
---|---|---|
@@ -1,14 +1,16 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const fs = require("fs") | ||
|
||
const TEST_PATH = "../../react-to-webcomponent.test.jsx" | ||
const REACT16_TEST_PATH = "./react-to-webcomponent.test.jsx" | ||
const TEST_PATH = "../../react-to-web-component.test.tsx" | ||
const REACT16_TEST_PATH = "./react-to-web-component.test.tsx" | ||
|
||
// copy test file from tests folder to react16 folder | ||
fs.copyFileSync(TEST_PATH, REACT16_TEST_PATH) | ||
|
||
// edit react-to-webcomponent test file's reactToWebComponent and components imports | ||
// read test file | ||
const data = fs.readFileSync(REACT16_TEST_PATH, "utf8") | ||
const result = data.replace(/..\/legacy\/react-to-webcomponent/g, "react-to-webcomponent/render") | ||
const result2 = result.replace(/.\/components/g, "../../components.tsx") | ||
// add react-to-web-component import to top of file | ||
const result = `import r2wc from '@r2wc/react-to-web-component';\n${data}` | ||
// remove r2wc mock from test file | ||
const result2 = result.replace("const r2wc = vi.fn()", "") | ||
fs.writeFileSync(REACT16_TEST_PATH, result2, "utf8") |
Oops, something went wrong.