Download next.js/test/e2e/import-meta/import-meta.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/import-meta/import-meta.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/import-meta/import-meta.test.ts
-
curl -L -o import-meta.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/import-meta/import-meta.test.ts
1.06 kB
| import { nextTestSetup } from 'e2e-utils' | |
| describe('import-meta', () => { | |
| const { next, isTurbopack } = nextTestSetup({ | |
| files: __dirname, | |
| }) | |
| describe('import.meta.url', () => { | |
| it('should work on the server', async () => { | |
| const $ = await next.render$('/') | |
| const testData = $('#test-data').text() | |
| const data = JSON.parse(testData) | |
| if (isTurbopack) { | |
| expect(data.url).toStartWith('file:///') | |
| expect(data.url).toEndWith('/pages/index.tsx') | |
| } else { | |
| expect(data.url).toStartWith('file:///') | |
| expect(data.url).toEndWith('/pages/index.tsx') | |
| } | |
| }) | |
| it('should work in browser', async () => { | |
| const browser = await next.browser('/') | |
| const testData = await browser.elementByCss('#test-data').text() | |
| const data = JSON.parse(testData) | |
| if (isTurbopack) { | |
| expect(data.url).toBe('file:///ROOT/pages/index.tsx') | |
| } else { | |
| expect(data.url).toStartWith('file:///') | |
| expect(data.url).toEndWith('/pages/index.tsx') | |
| } | |
| }) | |
| }) | |
| }) | |