Browse Source

Attempt at fixing the examples CI

Jeremy Tuloup 4 years ago
parent
commit
77c911aeae

+ 6 - 4
examples/chrome-example-test.js

@@ -21,12 +21,9 @@ async function main() {
   const handleMessage = async msg => {
     const text = msg.text();
     if (msg.type() === 'error') {
-      console.log(`ERROR>> ${text}`);
-      // console.dir(msg);
       errored = true;
-    } else {
-      console.log(`>> ${text}`);
     }
+    console.log(msg.type(), '>>', text);
     const lower = text.toLowerCase();
     if (lower === 'example started!' || lower === 'test complete!') {
       await browser.close();
@@ -36,6 +33,11 @@ async function main() {
       }
       console.info('Example test complete!');
       return;
+    } else {
+      if (errored) {
+        console.error('\n\n***\nExample test failed!\n***\n\n');
+        process.exit(1);
+      }
     }
   };
 

+ 1 - 1
jupyterlab/browser_check.py

@@ -142,7 +142,7 @@ async def run_async_process(cmd, **kwargs):
             **kwargs)
     stdout, stderr = await proc.communicate()
     if proc.returncode != 0:
-        raise RuntimeError(cmd + ' exited with ' + str(proc.returncode))
+        raise RuntimeError(str(cmd) + ' exited with ' + str(proc.returncode))
     return stdout, stderr
 
 

+ 8 - 0
packages/services/examples/browser/webpack.config.js

@@ -1,3 +1,5 @@
+const webpack = require('webpack');
+
 module.exports = {
   entry: './build/index.js',
   mode: 'development',
@@ -5,5 +7,11 @@ module.exports = {
     path: require('path').join(__dirname, 'build'),
     filename: 'bundle.js'
   },
+  plugins: [
+    new webpack.DefinePlugin({
+      'process.env': '{}',
+      process: {}
+    })
+  ],
   bail: true
 };