Skip to content

Commit e9d084a

Browse files
authored
Fix widget tests (#11406)
Tests are broken in Release branch
1 parent 52b4fbf commit e9d084a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/client/datascience/ipywidgets/localWidgetScriptSourceProvider.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,28 @@ export class LocalWidgetScriptSourceProvider implements IWidgetScriptSourceProvi
5555

5656
const validFiles = files.filter((file) => {
5757
// Should be of the form `<widget module>/index.js`
58-
const parts = file.split('/'); // On windows this uses the unix separator too.
58+
let parts = file.split('/'); // On windows this uses the unix separator too.
59+
if (parts.length === 1) {
60+
// Fall back if search API changes and returns results with OS path sep.
61+
parts = file.split('\\');
62+
}
5963
if (parts.length !== 2) {
60-
traceError('Incorrect file found when searching for nnbextension entrypoints');
64+
traceError(`Incorrect file found when searching for nnbextension entrypoints ${file}`);
6165
return false;
6266
}
6367
return true;
6468
});
6569

6670
const mappedFiles = validFiles.map(async (file) => {
6771
// Should be of the form `<widget module>/index.js`
68-
const parts = file.split('/');
72+
let parts = file.split('/'); // On windows this uses the unix separator too.
73+
if (parts.length === 1) {
74+
// Fall back if search API changes and returns results with OS path sep.
75+
parts = file.split('\\');
76+
}
6977
const moduleName = parts[0];
7078

71-
const fileUri = Uri.file(path.join(nbextensionsPath, file));
79+
const fileUri = Uri.file(path.join(nbextensionsPath, moduleName, parts[1]));
7280
const scriptUri = (await this.localResourceUriConverter.asWebviewUri(fileUri)).toString();
7381
// tslint:disable-next-line: no-unnecessary-local-variable
7482
const widgetScriptSource: WidgetScriptSource = { moduleName, scriptUri, source: 'local' };

src/test/datascience/ipywidgets/ipyWidgetScriptSourceProvider.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { InterpreterService } from '../../../client/interpreter/interpreterServi
2424

2525
// tslint:disable: no-any no-invalid-this
2626

27-
suite('xxxData Science - ipywidget - Widget Script Source Provider', () => {
27+
suite('Data Science - ipywidget - Widget Script Source Provider', () => {
2828
let scriptSourceProvider: IPyWidgetScriptSourceProvider;
2929
let notebook: INotebook;
3030
let configService: IConfigurationService;

0 commit comments

Comments
 (0)