mirror of
https://git.cloudron.io/cloudron/freshrss-app
synced 2026-04-22 10:53:57 +00:00
test: convert test to ESM
Replace CommonJS require() with ESM imports, add "type": "module" to test/package.json, remove 'use strict' and jshint directives, replace __dirname with import.meta.dirname. Made-with: Cursor
This commit is contained in:
@@ -13,5 +13,6 @@
|
||||
"mocha": "^11.7.5",
|
||||
"selenium-webdriver": "^4.40.0",
|
||||
"superagent": "^10.3.0"
|
||||
}
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
|
||||
23
test/test.js
23
test/test.js
@@ -1,19 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import 'chromedriver';
|
||||
import { execSync } from 'node:child_process';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import superagent from 'superagent';
|
||||
import { Builder, By, Key, until } from 'selenium-webdriver';
|
||||
import { Options } from 'selenium-webdriver/chrome';
|
||||
|
||||
/* global it, xit, describe, before, after, afterEach */
|
||||
|
||||
'use strict';
|
||||
|
||||
require('chromedriver');
|
||||
|
||||
const execSync = require('child_process').execSync,
|
||||
assert = require('node:assert/strict'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
superagent = require('superagent'),
|
||||
{ Builder, By, Key, until } = require('selenium-webdriver'),
|
||||
{ Options } = require('selenium-webdriver/chrome');
|
||||
|
||||
const admin_username = 'admin', admin_password = 'changeme';
|
||||
|
||||
if (!process.env.USERNAME || !process.env.PASSWORD) {
|
||||
@@ -26,7 +23,7 @@ describe('Application life cycle test', function () {
|
||||
|
||||
const LOCATION = process.env.LOCATION || 'test';
|
||||
const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000;
|
||||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||
const EXEC_ARGS = { cwd: path.resolve(import.meta.dirname, '..'), stdio: 'inherit' };
|
||||
|
||||
const USERNAME = process.env.USERNAME;
|
||||
const PASSWORD = process.env.PASSWORD;
|
||||
|
||||
Reference in New Issue
Block a user