Skip to content
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 API tests on windows and add missing await on ts test #7655

Merged
merged 2 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dev-packages/application-manager/src/expose-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ export = function (this: webpack.loader.LoaderContext, source: string, sourceMap
this.cacheable();
}

let modulePackage = modulePackages.find(({ dir }) => this.resourcePath.startsWith(dir + '/'));
let modulePackage = modulePackages.find(({ dir }) => this.resourcePath.startsWith(dir + path.sep));
if (modulePackage) {
this.callback(undefined, exposeModule(modulePackage, this.resourcePath, source), sourceMap);
return;
}
const index = this.resourcePath.lastIndexOf('/node_modules');
const searchString = path.sep + 'node_modules';
const index = this.resourcePath.lastIndexOf(searchString);
if (index !== -1) {
const nodeModulesPath = this.resourcePath.substring(0, index + '/node_modules'.length);
const nodeModulesPath = this.resourcePath.substring(0, index + searchString.length);
let dir = this.resourcePath;
while ((dir = path.dirname(dir)) !== nodeModulesPath) {
try {
Expand Down
19 changes: 12 additions & 7 deletions examples/api-tests/src/typescript.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// @ts-check
describe('TypeScript', function () {
this.timeout(45000);
this.timeout(30000);

const { assert } = chai;

Expand Down Expand Up @@ -131,7 +131,7 @@ module.exports = (port, host, argv) => Promise.resolve()
`
});
await pluginService.didStart;
Promise.all([typescriptPluginId, referencesPluginId].map(async pluginId => {
await Promise.all([typescriptPluginId, referencesPluginId].map(async pluginId => {
if (!pluginService.getPlugin(pluginId)) {
throw new Error(pluginId + ' should be started');
}
Expand Down Expand Up @@ -247,7 +247,12 @@ module.exports = (port, host, argv) => Promise.resolve()
assert.isTrue(contextKeyService.match('listFocus'));
}

async function closePeek() {
/**
* @param {MonacoEditor} editor
*/
async function closePeek(editor) {
await assertPeekOpened(editor);

keybindings.dispatchKeyDown('Escape');
await waitForAnimation(() => !contextKeyService.match('listFocus'));
assert.isTrue(contextKeyService.match('editorTextFocus'));
Expand Down Expand Up @@ -362,7 +367,7 @@ module.exports = (port, host, argv) => Promise.resolve()
// @ts-ignore
assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'container');

await closePeek();
await closePeek(activeEditor);
});

it(`from ${from} to another editor`, async function () {
Expand All @@ -388,7 +393,7 @@ module.exports = (port, host, argv) => Promise.resolve()
// @ts-ignore
assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'Container');

await closePeek();
await closePeek(activeEditor);
});

it(`from ${from} to an editor preview`, async function () {
Expand All @@ -412,7 +417,7 @@ module.exports = (port, host, argv) => Promise.resolve()
// @ts-ignore
assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'Container');

await closePeek();
await closePeek(activeEditor);
});
}
});
Expand Down Expand Up @@ -678,7 +683,7 @@ SPAN {
if (link) {
link.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
await assertPeekOpened(editor);
await closePeek();
await closePeek(editor);
} else {
assert.isDefined(link);
}
Expand Down