-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix launching extension in safari (#10908)
* Ensure the extension loads in the `Safari` browser * Misc * Misc * Fixes * Misc * Misc * oops * Inclue dependency * top * oops
- Loading branch information
1 parent
98d802e
commit ca46927
Showing
10 changed files
with
127 additions
and
63 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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
const { launch } = require('./launchWebUtils'); | ||
|
||
void launch(); |
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,60 +1,6 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const test_web = require('@vscode/test-web'); | ||
const { startJupyter } = require('./preLaunchWebTest'); | ||
const jsonc = require('jsonc-parser'); | ||
const { startReportServer } = require('./webTestReporter'); | ||
const { noop } = require('../out/test/core'); | ||
const { isCI } = require('./constants'); | ||
const extensionDevelopmentPath = path.resolve(__dirname, '../'); | ||
const packageJsonFile = path.join(extensionDevelopmentPath, 'package.json'); | ||
const { launch } = require('./launchWebUtils'); | ||
|
||
async function go() { | ||
let exitCode = 0; | ||
let server; | ||
let testServer; | ||
try { | ||
server = (await startJupyter()).server; | ||
testServer = await startReportServer(); | ||
const bundlePath = path.join(extensionDevelopmentPath, 'out', 'extension.web.bundle'); | ||
|
||
// Changing the logging level to be read from workspace settings file. | ||
// This way we can enable verbose logging and get the logs for web tests. | ||
const settingsJson = fs.readFileSync(packageJsonFile).toString(); | ||
const edits = jsonc.modify( | ||
settingsJson, | ||
['contributes', 'configuration', 'properties', 'jupyter.logging.level', 'scope'], | ||
'resource', | ||
{} | ||
); | ||
const updatedSettingsJson = jsonc.applyEdits(settingsJson, edits); | ||
fs.writeFileSync(packageJsonFile, updatedSettingsJson); | ||
|
||
// Now run the test | ||
await test_web.runTests({ | ||
browserType: 'chromium', | ||
verbose: true, | ||
headless: isCI ? false : true, // Set this to false to debug failures (false on CI to support capturing screenshots when tests fail). | ||
extensionDevelopmentPath, | ||
folderPath: path.resolve(__dirname, '..', 'src', 'test', 'datascience'), | ||
extensionTestsPath: bundlePath | ||
}); | ||
} catch (err) { | ||
console.error('Failed to run tests', err); | ||
exitCode = 1; | ||
} finally { | ||
if (testServer) { | ||
await testServer.dispose().catch(noop); | ||
} | ||
if (server) { | ||
await server.dispose(); | ||
} | ||
} | ||
|
||
// Not all promises complete. Force exit | ||
process.exit(exitCode); | ||
} | ||
void go(); | ||
void launch(true); |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const test_web = require('@vscode/test-web'); | ||
const { startJupyter } = require('./preLaunchWebTest'); | ||
const jsonc = require('jsonc-parser'); | ||
const { startReportServer } = require('./webTestReporter'); | ||
const { noop } = require('../out/test/core'); | ||
const { isCI } = require('./constants'); | ||
const extensionDevelopmentPath = path.resolve(__dirname, '../'); | ||
const packageJsonFile = path.join(extensionDevelopmentPath, 'package.json'); | ||
const yargs = require('yargs/yargs'); | ||
const { hideBin } = require('yargs/helpers'); | ||
const argv = yargs(hideBin(process.argv)).argv; | ||
|
||
const browserType = argv.browser || argv.browserType || 'chromium'; | ||
const port = argv.port || 3000; | ||
|
||
exports.launch = async function launch(launchTests) { | ||
let exitCode = 0; | ||
let server; | ||
let testServer; | ||
try { | ||
if (launchTests) { | ||
server = (await startJupyter()).server; | ||
testServer = await startReportServer(); | ||
} | ||
const bundlePath = path.join(extensionDevelopmentPath, 'out', 'extension.web.bundle'); | ||
|
||
// Changing the logging level to be read from workspace settings file. | ||
// This way we can enable verbose logging and get the logs for web tests. | ||
const settingsJson = fs.readFileSync(packageJsonFile).toString(); | ||
const edits = jsonc.modify( | ||
settingsJson, | ||
['contributes', 'configuration', 'properties', 'jupyter.logging.level', 'scope'], | ||
'resource', | ||
{} | ||
); | ||
const updatedSettingsJson = jsonc.applyEdits(settingsJson, edits); | ||
fs.writeFileSync(packageJsonFile, updatedSettingsJson); | ||
const options = { | ||
browserType, | ||
verbose: true, | ||
port, | ||
headless: isCI ? false : false, // Set this to false to debug failures (false on CI to support capturing screenshots when tests fail). | ||
extensionDevelopmentPath, | ||
folderPath: path.resolve(__dirname, '..', 'src', 'test', 'datascience') | ||
}; | ||
if (launchTests) { | ||
options.extensionTestsPath = bundlePath; | ||
} | ||
await test_web.runTests(options); | ||
} catch (err) { | ||
console.error(launchTests ? 'Failed to run tests' : 'Failed to launch VS Code', err); | ||
exitCode = 1; | ||
} finally { | ||
if (testServer) { | ||
await testServer.dispose().catch(noop); | ||
} | ||
if (server) { | ||
await server.dispose(); | ||
} | ||
} | ||
|
||
// Not all promises complete. Force exit | ||
process.exit(exitCode); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Ensure the extension loads in the `Safari` browser. |
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