Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Jun 30, 2024
1 parent 87fc829 commit 096b53f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ jobs:

steps:
- uses: actions/checkout@v2

- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v2
with:
node-version: 20

cache: "pnpm"
- run: pnpm install
- run: pnpm test
13 changes: 0 additions & 13 deletions src/__snapshots__/generate.test.ts.snap

This file was deleted.

11 changes: 10 additions & 1 deletion src/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ function bar() {}
export { foo as baz, bar };
`;
const result = generate(source);
expect(result).toMatchSnapshot();
expect(result).toBe(`function baz(){}
function bar(){}
(()=>{
const foo = 1;
function bar() {}
globalThis.baz=foo;
globalThis.bar=bar;
})()
`);
});
2 changes: 1 addition & 1 deletion src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function generate(source: string): string {
result += source.slice(lastEnd + 1, start)
lastEnd = end;
}
result = `${prefixDeclarations}(()=>{\n${result}${source.slice(lastEnd + 1)}\n${suffixDeclarations}})()`
result = `${prefixDeclarations}(()=>{\n${result}${source.slice(lastEnd + 1)}\n${suffixDeclarations}})()\n`

return result
}

0 comments on commit 096b53f

Please sign in to comment.