tests/unit: Access shell sources from resource
Unit tests currently load shell sources directly from the filesystem. This is currently blocking generated sources - namely config.js - to ESM, because a relative import from the source dir will fail to locate the file in the build dir. Address this by using the same GResource as gnome-shell instead of direct filesystem access, as the resource will always include all sources files at the expected location. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2880>
This commit is contained in:
parent
09525ece8c
commit
9546860d05
@ -263,7 +263,7 @@ if have_networkmanager
|
||||
)
|
||||
endif
|
||||
|
||||
executable('gnome-shell-perf-helper', 'shell-perf-helper.c',
|
||||
executable('gnome-shell-perf-helper', 'shell-perf-helper.c', js_resources,
|
||||
dependencies: [gtk_dep, gio_dep, m_dep],
|
||||
include_directories: [conf_inc],
|
||||
install_dir: libexecdir,
|
||||
|
@ -5,8 +5,8 @@
|
||||
const JsUnit = imports.jsUnit;
|
||||
import Pango from 'gi://Pango';
|
||||
|
||||
import '../../js/ui/environment.js';
|
||||
import * as Util from '../../js/misc/util.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
|
||||
|
||||
const tests = [
|
||||
{
|
||||
|
@ -2,9 +2,9 @@ const JsUnit = imports.jsUnit;
|
||||
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
import '../../js/ui/environment.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
|
||||
import {InjectionManager} from '../../js/extensions/extension.js';
|
||||
import {InjectionManager} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
|
||||
class Object1 {
|
||||
count = 0;
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
// Needed so that Util can bring some UI stuff
|
||||
// we don't actually use
|
||||
import '../../js/ui/environment.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
|
||||
import * as Assertions from '../common/assertions.js';
|
||||
|
||||
import * as Util from '../../js/misc/util.js';
|
||||
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
|
||||
|
||||
let arrayInt = [1, 2, 3, 5, 6];
|
||||
Util.insertSorted(arrayInt, 4, (one, two) => one - two);
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
const JsUnit = imports.jsUnit;
|
||||
|
||||
import '../../js/ui/environment.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
|
||||
import * as Assertions from '../common/assertions.js';
|
||||
|
||||
import * as JsParse from '../../js/misc/jsParse.js';
|
||||
import * as JsParse from 'resource:///org/gnome/shell/misc/jsParse.js';
|
||||
|
||||
const HARNESS_COMMAND_HEADER = 'let imports = obj;' +
|
||||
'let global = obj;' +
|
||||
|
@ -5,10 +5,10 @@
|
||||
const JsUnit = imports.jsUnit;
|
||||
import Pango from 'gi://Pango';
|
||||
|
||||
import '../../js/ui/environment.js';
|
||||
import '../../js/ui/main.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
import 'resource:///org/gnome/shell/ui/main.js';
|
||||
|
||||
import * as MessageList from '../../js/ui/messageList.js';
|
||||
import * as MessageList from 'resource:///org/gnome/shell/ui/messageList.js';
|
||||
|
||||
/**
|
||||
* Assert that `input`, assumed to be markup, gets "fixed" to `output`,
|
||||
|
@ -1,5 +1,5 @@
|
||||
const JsUnit = imports.jsUnit;
|
||||
import * as Params from '../../js/misc/params.js';
|
||||
import * as Params from 'resource:///org/gnome/shell/misc/params.js';
|
||||
|
||||
/**
|
||||
* Asserts that two "param" objects have the same properties
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
// Test cases for version comparison
|
||||
|
||||
import '../../js/ui/environment.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
const JsUnit = imports.jsUnit;
|
||||
import * as Signals from '../../js/misc/signals.js';
|
||||
import * as Signals from 'resource:///org/gnome/shell/misc/signals.js';
|
||||
|
||||
import {TransientSignalHolder, registerDestroyableType} from '../../js/misc/signalTracker.js';
|
||||
import {TransientSignalHolder, registerDestroyableType} from 'resource:///org/gnome/shell/misc/signalTracker.js';
|
||||
|
||||
const Destroyable = GObject.registerClass({
|
||||
Signals: {'destroy': {}},
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
const JsUnit = imports.jsUnit;
|
||||
|
||||
import '../../js/ui/environment.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
|
||||
import * as Util from '../../js/misc/util.js';
|
||||
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
|
||||
|
||||
const tests = [
|
||||
{
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
const JsUnit = imports.jsUnit;
|
||||
|
||||
import '../../js/ui/environment.js';
|
||||
import 'resource:///org/gnome/shell/ui/environment.js';
|
||||
|
||||
import * as Util from '../../js/misc/util.js';
|
||||
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
|
||||
|
||||
const tests = [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user