-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix launching extension in safari #10908
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a068517
Ensure the extension loads in the `Safari` browser
DonJayamanne a0ffce8
Misc
DonJayamanne 5afc179
Misc
DonJayamanne b27a015
Fixes
DonJayamanne d9dde71
Misc
DonJayamanne 859fada
Misc
DonJayamanne d0b8256
oops
DonJayamanne 98506b5
Inclue dependency
DonJayamanne 39bc902
top
DonJayamanne aca4f3f
oops
DonJayamanne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added ability to launch extension in vscode web locally