-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: downgrade prettier to use inline snapshot
- Loading branch information
Showing
17 changed files
with
240 additions
and
270 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,9 +42,10 @@ pre > code { | |
color: #333; | ||
} | ||
|
||
a, a:visited { | ||
a, | ||
a:visited { | ||
color: #333; | ||
} | ||
a:hover { | ||
color: #999; | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,19 +1,18 @@ | ||
import { createCliTest } from '../../testing-utils' | ||
import { createJob } from '../../testing-utils' | ||
|
||
describe('cli', () => { | ||
describe('cli - output-in-watch', () => { | ||
const { job } = createJob({ | ||
directory: __dirname, | ||
args: ['hello.js', '-w', '-o', 'dist/hello.bundle.js'], | ||
abortTimeout: 3000, | ||
}) | ||
it(`cli output-in-watch should work properly`, async () => { | ||
await createCliTest( | ||
{ | ||
directory: __dirname, | ||
args: ['hello.js', '-w', '-o', 'dist/hello.bundle.js'], | ||
abortTimeout: 3000, | ||
}, | ||
({ signal, stdout, stderr }) => { | ||
console.log('stdout', stdout, stderr) | ||
expect(stdout.includes('Watching project')).toBe(true) | ||
expect(stdout.includes('Exports')).toBe(false) | ||
expect(signal).toBe('SIGTERM') // SIGTERM exit code | ||
}, | ||
) | ||
const { signal, stdout } = job | ||
|
||
expect(stdout).toMatchInlineSnapshot(` | ||
"Watching changes in the project directory... | ||
" | ||
`) | ||
expect(signal).toBe('SIGTERM') // SIGTERM exit code | ||
}) | ||
}) |
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,20 +1,21 @@ | ||
import { createIntegrationTest, assertFilesContent } from '../../testing-utils' | ||
import { | ||
assertFilesContent, | ||
createJob, | ||
stripANSIColor, | ||
} from '../../testing-utils' | ||
|
||
describe('integration entry-index-index', () => { | ||
const { distDir, job } = createJob({ | ||
directory: __dirname, | ||
}) | ||
it('should work with index file inside index directory', async () => { | ||
await createIntegrationTest( | ||
{ | ||
directory: __dirname, | ||
}, | ||
async ({ distDir, stdout }) => { | ||
await assertFilesContent(distDir, { | ||
'default.js': /'index'/, | ||
'react-server.js': /\'react-server\'/, | ||
}) | ||
await assertFilesContent(distDir, { | ||
'default.js': /'index'/, | ||
'react-server.js': /\'react-server\'/, | ||
}) | ||
|
||
expect(stdout).toContain('dist/react-server.js') | ||
expect(stdout).toContain('dist/default.js') | ||
}, | ||
) | ||
const stdout = stripANSIColor(job.stdout) | ||
expect(stdout).toContain('. dist/default.js') | ||
expect(stdout).toContain('. (react-server) dist/react-server.js') | ||
}) | ||
}) |
42 changes: 0 additions & 42 deletions
42
test/integration/mixed-directives/__snapshots__/mixed-directives.test.ts.snap
This file was deleted.
Oops, something went wrong.
65 changes: 44 additions & 21 deletions
65
test/integration/mixed-directives/mixed-directives.test.ts
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,28 +1,51 @@ | ||
import { readFileSync } from 'fs' | ||
import { | ||
createIntegrationTest, | ||
getFileNamesFromDirectory, | ||
} from '../../testing-utils' | ||
import { getFileContents, createJob } from '../../testing-utils' | ||
|
||
describe('integration - mixed-directives', () => { | ||
const { distDir } = createJob({ | ||
directory: __dirname, | ||
}) | ||
it('should work with js only project', async () => { | ||
await createIntegrationTest( | ||
const fileContents = await getFileContents(distDir) | ||
|
||
expect(fileContents).toMatchInlineSnapshot(` | ||
{ | ||
directory: __dirname, | ||
}, | ||
async ({ distDir }) => { | ||
const distFiles = await getFileNamesFromDirectory(distDir) | ||
const fileContents = distFiles | ||
.map((file) => [file, readFileSync(`${distDir}/${file}`, 'utf-8')]) | ||
.reduce((acc, pair) => { | ||
return { | ||
...acc, | ||
[pair[0]]: pair[1], | ||
} | ||
}, {}) | ||
"action-server-DOTFC6td.js": "'use server'; | ||
async function action1() { | ||
return 'action1'; | ||
} | ||
export { action1 as a }; | ||
", | ||
"client.js": "'use client'; | ||
import { jsx } from 'react/jsx-runtime'; | ||
import { a as action1 } from './action-server-DOTFC6td.js'; | ||
function Page() { | ||
return /*#__PURE__*/ jsx("button", { | ||
onClick: action1, | ||
children: "Action 1" | ||
}); | ||
} | ||
export { Page as default }; | ||
", | ||
"inline.js": "import { jsx } from 'react/jsx-runtime'; | ||
import ClientComponent from 'client-component'; | ||
// @ts-ignore externals | ||
function Page() { | ||
async function inlineAction() { | ||
'use server'; | ||
return 'inline-action'; | ||
} | ||
return /*#__PURE__*/ jsx(ClientComponent, { | ||
action: inlineAction | ||
}); | ||
} | ||
expect(fileContents).toMatchSnapshot(``) | ||
}, | ||
) | ||
export { Page as default }; | ||
", | ||
} | ||
`) | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"target": "ES2022" | ||
} | ||
} | ||
}, | ||
"exclude": ["*.test.ts"] | ||
} |
12 changes: 3 additions & 9 deletions
12
test/integration/monorepo-composite-no-incremental/index.test.ts
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,15 +1,9 @@ | ||
import { join } from 'path' | ||
import { assertContainFiles, createIntegrationTest } from '../../testing-utils' | ||
import { assertContainFiles, createJob } from '../../testing-utils' | ||
|
||
describe('integration monorepo-composite-no-incremental', () => { | ||
const { distDir } = createJob({ directory: join(__dirname, 'packages', 'a') }) | ||
it('should succeed the build', async () => { | ||
await createIntegrationTest( | ||
{ | ||
directory: join(__dirname, 'packages', 'a'), | ||
}, | ||
async ({ distDir }) => { | ||
await assertContainFiles(distDir, ['index.js', 'index.d.ts']) | ||
}, | ||
) | ||
await assertContainFiles(distDir, ['index.js', 'index.d.ts']) | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -8,5 +8,6 @@ | |
{ | ||
"path": "./packages/a" | ||
} | ||
] | ||
], | ||
"exclude": ["*.test.ts"] | ||
} |
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,52 +1,44 @@ | ||
import { | ||
assertFilesContent, | ||
createIntegrationTest, | ||
getChunkFileNamesFromLog, | ||
stripANSIColor, | ||
createJob, | ||
getFileNamesFromDirectory, | ||
} from '../../testing-utils' | ||
|
||
describe('integration multi-entries', () => { | ||
describe('integration - multi-entries', () => { | ||
const { dir, distDir, job } = createJob({ directory: __dirname }) | ||
it('should contain files', async () => { | ||
await createIntegrationTest( | ||
{ | ||
directory: __dirname, | ||
}, | ||
async ({ dir, stdout }) => { | ||
const contentsRegex = { | ||
'./dist/index.js': /'index'/, | ||
'./dist/shared/index.mjs': /'shared'/, | ||
'./dist/shared/edge-light.mjs': /'shared.edge-light'/, | ||
'./dist/server/edge.mjs': /'server.edge-light'/, | ||
'./dist/server/react-server.mjs': /'server.react-server'/, | ||
// types | ||
'./dist/server/index.d.ts': `export { Client } from '../client/index.js';\nexport { Shared } from '../shared/index.js';`, | ||
'./dist/client/index.d.ts': `export { Shared } from '../shared/index.js'`, | ||
} | ||
const contentsRegex = { | ||
'./dist/index.js': /'index'/, | ||
'./dist/shared/index.mjs': /'shared'/, | ||
'./dist/shared/edge-light.mjs': /'shared.edge-light'/, | ||
'./dist/server/edge.mjs': /'server.edge-light'/, | ||
'./dist/server/react-server.mjs': /'server.react-server'/, | ||
// types | ||
'./dist/server/index.d.ts': `export { Client } from '../client/index.js';\nexport { Shared } from '../shared/index.js';`, | ||
'./dist/client/index.d.ts': `export { Shared } from '../shared/index.js'`, | ||
} | ||
|
||
await assertFilesContent(dir, contentsRegex) | ||
await assertFilesContent(dir, contentsRegex) | ||
|
||
const log = `\ | ||
dist/index.js | ||
dist/index.d.ts | ||
dist/lite.js | ||
dist/client/index.mjs | ||
dist/client/index.cjs | ||
dist/client/index.d.ts | ||
dist/server/index.mjs | ||
dist/server/index.d.ts | ||
dist/server/edge.mjs | ||
dist/server/react-server.mjs | ||
dist/shared/index.mjs | ||
dist/shared/index.cjs | ||
dist/shared/index.d.ts | ||
dist/shared/edge-light.mjs | ||
` | ||
const files = await getFileNamesFromDirectory(distDir) | ||
|
||
const rawStdout = stripANSIColor(stdout) | ||
getChunkFileNamesFromLog(log).forEach((chunk: string) => { | ||
expect(rawStdout).toContain(chunk) | ||
}) | ||
}, | ||
) | ||
expect(files).toMatchInlineSnapshot(` | ||
[ | ||
"client/index.cjs", | ||
"client/index.d.ts", | ||
"client/index.mjs", | ||
"index.d.ts", | ||
"index.js", | ||
"lite.js", | ||
"server/edge.mjs", | ||
"server/index.d.ts", | ||
"server/index.mjs", | ||
"server/react-server.mjs", | ||
"shared/edge-light.mjs", | ||
"shared/index.cjs", | ||
"shared/index.d.ts", | ||
"shared/index.mjs", | ||
] | ||
`) | ||
}) | ||
}) |
Oops, something went wrong.