Commit 01005991 authored by Houssein Djirdeh's avatar Houssein Djirdeh Committed by Joe Haddad

Add version property to Next.js instance (#8499)

* adds global for next version

* updates to use env variable and keeps it local

* Test Next.js version presence

* Unfocus test
parent 12c211bd
......@@ -30,6 +30,8 @@ if (!window.Promise) {
const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent)
window.__NEXT_DATA__ = data
export const version = process.env.__NEXT_VERSION
const {
props,
err,
......
......@@ -586,6 +586,20 @@ describe('Production Usage', () => {
expect(existsSync(join(appDir, '.next', 'profile-events.json'))).toBe(false)
})
it('should contain the Next.js version in window export', async () => {
let browser
try {
browser = await webdriver(appPort, '/about')
const version = await browser.eval('window.next.version')
expect(version).toBeTruthy()
expect(version).toBe(require('next/package.json').version)
} finally {
if (browser) {
await browser.close()
}
}
})
dynamicImportTests(context, (p, q) => renderViaHTTP(context.appPort, p, q))
processEnv(context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment