Skip to content

Commit

Permalink
moving more cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed May 18, 2023
1 parent eef3cc4 commit ad6d71d
Show file tree
Hide file tree
Showing 33 changed files with 842 additions and 580 deletions.
31 changes: 0 additions & 31 deletions crossbow.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

119 changes: 0 additions & 119 deletions cypress/integration/file-reloading.js

This file was deleted.

25 changes: 25 additions & 0 deletions examples/basic/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const bs = require("../../packages/browser-sync/dist/index").create();
const path = require("path");
const serverDir = path.join(__dirname, "..", "..", "packages/browser-sync/test/fixtures");

bs.init(
{
server: serverDir,
open: false,
notify: false,
watch: true,
online: false
},
(err, bs) => {
const message = {
kind: "ready",
urls: bs.options.get("urls").toJS(),
cwd: serverDir
};
if (process.send) {
process.send(message);
} else {
console.log(message);
}
}
);
8 changes: 4 additions & 4 deletions examples/options.snippetOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ browserSync.init({
snippetOptions: {
rule: {
match: /<\/head>/i,
fn: function (snippet, match) {
fn: function(snippet, match) {
return snippet + match;
},
},
},
}
}
}
});
6 changes: 3 additions & 3 deletions examples/server.proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"use strict";

var browserSync = require("browser-sync").create();
var express = require('express');
var proxy = require('http-proxy-middleware');
var express = require("express");
var proxy = require("http-proxy-middleware");

var app = express();

app.use('/api', proxy({target: 'http://www.example.org', changeOrigin: true}));
app.use("/api", proxy({ target: "http://www.example.org", changeOrigin: true }));

browserSync.init({
server: ".",
Expand Down
24 changes: 13 additions & 11 deletions examples/snippet/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>Hello world</h1>
</body>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<h1>Hello world</h1>
</body>
</html>
16 changes: 10 additions & 6 deletions examples/snippet/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ bs.init(
snippetOptions: {
rule: {
match: /<\/head>/i,
fn: function (snippet, match) {
fn: function(snippet, match) {
return snippet + match;
},
},
},
}
}
}
},
(err, bs) => {
const message = { kind: 'ready', urls: bs.options.get("urls").toJS() };
const message = {
kind: "ready",
urls: bs.options.get("urls").toJS(),
cwd: __dirname
};
if (process.send) {
process.send(message)
process.send(message);
} else {
console.log(message);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/tailwind/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
@tailwind utilities;

body {
color: red
color: red;
}
27 changes: 14 additions & 13 deletions examples/tailwind/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./dist/output.css">
</head>
<body class="p-4">
<p class=text-4xl>hello world 5.0</p>
</body>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<link rel="stylesheet" href="./dist/output.css" />
</head>
<body class="p-4">
<p class="text-4xl">hello world 5.0</p>
</body>
</html>

12 changes: 6 additions & 6 deletions examples/tailwind/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ bs.init(
]
},
(err, bs) => {
const message = { kind: 'ready', urls: bs.options.get("urls").toJS() };
if (process.send) {
process.send(message)
} else {
console.log(message);
}
const message = {
kind: "ready",
urls: bs.options.get("urls").toJS(),
cwd: __dirname
};
process.send?.(message);
}
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test.e2e": "playwright test",
"test.e2e.headed": "playwright test --headed",
"pretest.e2e": "if [ \\\"$CI\\\" == \\\"true\\\" ]; then lerna run build; else lerna run build --since HEAD; fi",
"prettier": "prettier 'packages/**/*.{js,ts,html,yml,css}'",
"prettier": "prettier '{packages,tests,examples}/**/*.{js,ts,html,yml,css}'",
"prettier.write": "npm run prettier -- --write"
},
"devDependencies": {
Expand Down

0 comments on commit ad6d71d

Please sign in to comment.