Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
29a21c97
Commit
29a21c97
authored
Oct 23, 2018
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temporarily disable process.browser
parent
70978a4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
process-env.js
test/integration/production/test/process-env.js
+14
-14
No files found.
test/integration/production/test/process-env.js
View file @
29a21c97
...
@@ -17,19 +17,19 @@ export default (context) => {
...
@@ -17,19 +17,19 @@ export default (context) => {
})
})
})
})
describe
(
'process.browser'
,
()
=>
{
//
describe('process.browser', () => {
it
(
'should eliminate server only code on the client'
,
async
()
=>
{
//
it('should eliminate server only code on the client', async () => {
const
buildId
=
await
readNextBuildFile
(
'./BUILD_ID'
)
//
const buildId = await readNextBuildFile('./BUILD_ID')
const
clientCode
=
await
readNextBuildFile
(
`./static/
${
buildId
}
/pages/process-env.js`
)
//
const clientCode = await readNextBuildFile(`./static/${buildId}/pages/process-env.js`)
expect
(
clientCode
).
toMatch
(
/__THIS_SHOULD_ONLY_BE_DEFINED_IN_BROWSER_CONTEXT__/
)
//
expect(clientCode).toMatch(/__THIS_SHOULD_ONLY_BE_DEFINED_IN_BROWSER_CONTEXT__/)
expect
(
clientCode
).
not
.
toMatch
(
/__THIS_SHOULD_ONLY_BE_DEFINED_IN_SERVER_CONTEXT__/
)
//
expect(clientCode).not.toMatch(/__THIS_SHOULD_ONLY_BE_DEFINED_IN_SERVER_CONTEXT__/)
})
//
})
it
(
'should eliminate client only code on the server'
,
async
()
=>
{
//
it('should eliminate client only code on the server', async () => {
const
buildId
=
await
readNextBuildFile
(
'./BUILD_ID'
)
//
const buildId = await readNextBuildFile('./BUILD_ID')
const
serverCode
=
await
readNextBuildFile
(
`./server/static/
${
buildId
}
/pages/process-env.js`
)
//
const serverCode = await readNextBuildFile(`./server/static/${buildId}/pages/process-env.js`)
expect
(
serverCode
).
not
.
toMatch
(
/__THIS_SHOULD_ONLY_BE_DEFINED_IN_BROWSER_CONTEXT__/
)
//
expect(serverCode).not.toMatch(/__THIS_SHOULD_ONLY_BE_DEFINED_IN_BROWSER_CONTEXT__/)
expect
(
serverCode
).
toMatch
(
/__THIS_SHOULD_ONLY_BE_DEFINED_IN_SERVER_CONTEXT__/
)
//
expect(serverCode).toMatch(/__THIS_SHOULD_ONLY_BE_DEFINED_IN_SERVER_CONTEXT__/)
})
//
})
})
//
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment