marko-js / cli Goto Github PK
View Code? Open in Web Editor NEWcommand-line tools for Marko
License: MIT License
command-line tools for Marko
License: MIT License
I want to access some of the site's API interfaces. Through the fetch API, but setting mode: 'cors' can be reported incorrectly.i need to set up a cross-domain agent, but i can't see the documentation. How should I set up an agent?
I can't seem to get compiling XML to work with this. I only need this once so I would like to do it with marko-devtools instead of the node require.
marko compile -f sitemap.xml.marko
/home/luca/websites/test/node_modules/marko/compiler/Compiler.js:84
throw error;
^
Error: An error occurred while trying to compile template at path "/home/luca/websites/test/sitemap.xml.marko". Error(s) in template:
1) [sitemap.xml.marko:2:0] Unrecognized tag: urlset - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
2) [sitemap.xml.marko:3:2] Unrecognized tag: url - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
3) [sitemap.xml.marko:4:4] Unrecognized tag: loc - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
4) [sitemap.xml.marko:5:4] Unrecognized tag: lastmod - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
5) [sitemap.xml.marko:6:4] Unrecognized tag: priority - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
sitemap.xml.marko:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://${data.site}/</loc>
<lastmod>2017-04-07</lastmod>
<priority>1</priority>
</url>
</urlset>
Same as title said. fail to download by dependency.
[email protected] install /Users/chalang/node_modules/@marko/test/node_modules/puppeteer
node install.js
ERROR: Failed to download Chromium r497674! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
[email protected] /Users/
└── (empty)
npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/chalang/.nvm/versions/node/v6.12.0/bin/node" "/Users/chalang/.nvm/versions/node/v6.12.0/bin/npm" "install"
npm ERR! node v6.12.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
Node: v8.9.4
Npm: 6.0.0
Nvm: 0.33.2
When running npm install marko-cli --global
, I get a ProcessTerminatedError
. The stack trace is listed below
7718 silly extract [email protected]
7719 silly extract [email protected]
7720 timing action:extract Completed in 1433ms
7721 verbose unlock done using /Users/username/.npm/_locks/staging-d882a266428e8223.lock for /Users/username/.nvm/versions/node/v8.9.4/l$
7722 timing stage:rollbackFailedOptional Completed in 0ms
7723 timing stage:runTopLevelLifecycles Completed in 6059ms
7724 verbose type ProcessTerminatedError
7725 verbose stack ProcessTerminatedError: cancel after 1 retries!
7725 verbose stack at Farm.<anonymous> (/Users/username/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/worker-farm/lib/$
7725 verbose stack at Array.forEach (<anonymous>)
7725 verbose stack at Farm.<anonymous> (/Users/username/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/worker-farm/lib/$
7725 verbose stack at ontimeout (timers.js:475:11)
7725 verbose stack at tryOnTimeout (timers.js:310:5)
7725 verbose stack at Timer.listOnTimeout (timers.js:270:5)
7726 verbose cwd /Users/username/Documents/sites
7727 verbose Darwin 17.5.0
Hi,
When I attempt to run test in browser (with the example took in the README), I get this error:
Server running at http://localhost:1024
An error occurred while running command test: Error: Failed to launch chrome!
[0224/142447.731001:FATAL:zygote_host_impl_linux.cc(123)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x55668c32c337 base::debug::StackTrace::StackTrace()
#1 0x55668c33fff1 logging::LogMessage::~LogMessage()
#2 0x55668b527651 content::ZygoteHostImpl::Init()
#3 0x55668b1b6d50 content::BrowserMainLoop::EarlyInitialization()
#4 0x55668b1bd493 content::BrowserMainRunnerImpl::Initialize()
#5 0x55668fd63075 headless::HeadlessContentMainDelegate::RunProcess()
#6 0x55668c03d3b7 content::RunNamedProcessTypeMain()
#7 0x55668c03de0d content::ContentMainRunnerImpl::Run()
#8 0x55668c0459d4 service_manager::Main()
#9 0x55668c03c952 content::ContentMain()
#10 0x55668eac9225 headless::(anonymous namespace)::RunContentMain()
#11 0x55668eac929c headless::HeadlessBrowserMain()
#12 0x55668c0437f7 headless::HeadlessShellMain()
#13 0x55668ac10bbe ChromeMain
#14 0x7fe757b1df4a __libc_start_main
#15 0x55668ac10a10 <unknown>
Received signal 6
#0 0x55668c32c337 base::debug::StackTrace::StackTrace()
#1 0x55668c32beaf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7fe75df21dd0 <unknown>
#3 0x7fe757b31860 __GI_raise
#4 0x7fe757b32ec9 __GI_abort
#5 0x55668c32aee2 base::debug::BreakDebugger()
#6 0x55668c3404ac logging::LogMessage::~LogMessage()
#7 0x55668b527651 content::ZygoteHostImpl::Init()
#8 0x55668b1b6d50 content::BrowserMainLoop::EarlyInitialization()
#9 0x55668b1bd493 content::BrowserMainRunnerImpl::Initialize()
#10 0x55668fd63075 headless::HeadlessContentMainDelegate::RunProcess()
#11 0x55668c03d3b7 content::RunNamedProcessTypeMain()
#12 0x55668c03de0d content::ContentMainRunnerImpl::Run()
#13 0x55668c0459d4 service_manager::Main()
#14 0x55668c03c952 content::ContentMain()
#15 0x55668eac9225 headless::(anonymous namespace)::RunContentMain()
#16 0x55668eac929c headless::HeadlessBrowserMain()
#17 0x55668c0437f7 headless::HeadlessShellMain()
#18 0x55668ac10bbe ChromeMain
#19 0x7fe757b1df4a __libc_start_main
#20 0x55668ac10a10 <unknown>
r8: 0000000000000000 r9: 00007ffd96946aa0 r10: 0000000000000008 r11: 0000000000000246
r12: 00007ffd969471c0 r13: 0000000000000161 r14: 00007ffd969471b8 r15: 00007ffd969471b0
di: 0000000000000002 si: 00007ffd96946aa0 bp: 00007ffd96946d60 bx: 0000000000000006
dx: 0000000000000000 ax: 0000000000000000 cx: 00007fe757b31860 sp: 00007ffd96946aa0
ip: 00007fe757b31860 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at Interface.onClose (.npm-global/lib/node_modules/marko-cli/node_modules/puppeteer/lib/Launcher.js:142:14)
at emitNone (events.js:110:20)
at Interface.emit (events.js:207:7)
at Interface.close (readline.js:370:8)
at Socket.onend (readline.js:149:10)
at emitNone (events.js:110:20)
at Socket.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
OS: Archlinux
I extended the marko-lasso example with marko-devtools: https://github.com/abiyasa/marko-lasso/tree/marko-devtools
I added a simple test but one of the test is failing due to it's not being rendered. Here's the template:
class {
// ...
}
<div.count>
${state.count}
</div>
<button.example-button on-click('increment')>
Click me!
</button>
When I run the test on browser/phantomjs, these are the html result (I console.log the context.render's html):
<div class="count" id="b2-_r0">0</div>
The same test pass completely when it runs on the server (by renaming the test.js
file to test.server.js
). The HTML result:
<div class="count" id="s0-_r0">0</div><button class="example-button" id="s0-_r1" data-marko=\'{"onclick":"increment s0"}\'>Click me!</button>
Notice that the button is missing when rendered on the browser.
However, if I change the template to only 1 root by adding a container div, the test passes on both browser & server. Here's the new template:
<div>
<div.count>
${state.count}
</div>
<button.example-button on-click('increment')>
Click me!
</button>
</div>
The HTML result on browser test:
<div id="b2"><div class="count">0</div><button class="example-button">Click me!</button></div>
Greetings,
When following the installation article on markojs.com and after installing marko-cli, when I attempt to create a new marko project I get the following error:
marko create test
module.js:515
throw err;
^
Error: Cannot find module '../src/cli'
at Function.Module._resolveFilename (module.js:513:15)
at Function.Module._load (module.js:463:25)
at Module.require (module.js:556:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/bin/marko:2:11)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
at Function.Module._load (module.js:486:3)
I'm on a Mac OS Sierra and have installed latest node (8.8.0).
Any pointers would be appreciated.
I’m currently playing with marko-devtools on testing client-side behaviour on Marko 4. As you can see on the test file on my project, the test code becomes too verbose due to we have to render the component for each test.
describe('when rendered', function () {
test('should render count', function (context) {
var renderResult = context.render({});
var count = renderResult.$('.count').text();
expect(count).to.equal('0');
});
test('should render incrementor button', function (context) {
var renderResult = context.render({});
var $button = renderResult.$('.example-button');
expect($button).to.have.length(1);
});
});
Imagine if you start testing clicks, then you would have to render & click for each test.
Would be very helpful if marko-devtools test could support BDD-style like this:
describe('when rendered', function () {
var renderContext;
var input = {};
beforeEach(function () {
renderContext = createRenderingContext(input);
});
it('should render count', function () {
var count = renderContext.$('.count').text();
expect(count).to.equal('0');
});
it('should render incrementor button', function () {
var $button = renderContext.$('.example-button');
expect($button).to.have.length(1);
});
});
My suggestion is to expose the function to create render result (renderCreateContext()
on example above, function name is not final), so:
test()
in order to render the component. You can do inside it() or beforeEach().Let me know what you think about this, and I'd like to offer my help implementing this new feature since this will help our team migrating lots of Marko 3 component tests easily
Steps to reproduce:
marko-create my-project
cd my-project
npm test
it runs the linter
In package.json
"test": "npm run lint",
should be
"test": "marko test",
When I try to create a project with marko-cli, I get these error messages:
$ marko create marko-demo
× Unable to find a matching app template. None of the following exist:
- marko-js-samples/demo
- marko-js-samples/marko-demo
- marko-js-samples/marko-starter-demo
Do I need to clone those repos somewhere?
I am behind a proxy server, can that be a problem?
Hi guys.
I try run marko test ./src/**/test*.js
and show this error ([email protected]):
Server running at http://localhost:1024
Launching tests using HeadlessChrome/62.0.3198.0
events.js:163
throw er; // Unhandled 'error' event
^
Error: Render async fragment error (lasso-slot:head). Exception: Error: Failed to walk dependency [require: stream]. Dependency chain: [require: ~/my-app/node_modules/marko-cli/src/commands/test/util/browser-tests-runner/setup.js] → [require: ./BrowserContext] → [require: cheerio] → [require: ./lib/cheerio] → [require: ./parse] → [require: htmlparser2] → [require: ./FeedHandler.js] → [require: ./index.js] → [require: ./Stream.js] → [require: ./WritableStream.js] → [require: stream]. Cause: Error: Module not found: emitter (from "node_modules/stream" and referenced in "node_modules/stream/index.js")
plugins/my-component/index.marko
<div>A simple component</div>
plugins/my-component/test.js
const { expect } = require('chai');
test('should to be true', (context) => {
const output = context.render({});
expect(output.html).to.contain('A');
});
marko.json
{
"tags-dir": ["./plugins"]
}
The documentation should specify that Marko CLI 4.4.7 (and probably earlier), the supported version of node, just found that node 4 was not happy with me trying to run it >.<
This is my stack-trace:
Server running at http://localhost:1024
Running "http://localhost:1024" using mocha-phantomjs...
Error: Cannot find module "/marko-form$1.0.0/components/marko-form-input/test/test" from "/"
in requireModule at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:434
in require at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:472
in run at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:485
in ready at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:506
Error loading resource http://localhost:1024/static/browser-tests-runner/marko-devtools$1.0.2/src/commands/test/util/browser-tests-runner/mocha-run.js (5). Details: Operation canceled
Error loading resource http://localhost:1024/static/browser-tests-runner/marko-devtools$1.0.2/src/commands/test/util/browser-tests-runner/mocha-run-run.js (5). Details: Operation canceled
Exiting, closing server...
And this is my project tree view:
|- marko-form
|- components
|- marko-form-input
|- test
|- test.js
|- browser.json
|- component.js
|- index.marko
|- marko-tag.json
|- package.json
|- marko.json
My test.js
content is:
/* globals test */
'use strict'
const expect = require('chai').expect
test('input-text', function(context) {
const output = context.render({
'formName': 'myForm',
'name': 'myInput',
'type': 'text'
})
expect(output.html).to.contain('input')
})
Hi. I'm following the Color picker tutorial and I've got to the test part.
I think it might be how the context render the output.
This is how I have my folders structure:
/src
|__/components
|__/color-picker
|__/components
|__/color-picker-header
|__/test
|__test.js
Then, in my test.js file, I have this:
const expect = require('chai').expect;
test('color-picker-header color', function (context) {
const output = context.render({
color: '#000000'
});
expect(output.$('div').attr('style')).to.contain('background-color:#000000');
});
So, running the test, I've got the next error:
AssertionError: object tested must be an array, a map, an object, a set, a string, or a weakset, but undefined given
To see what was happening, I used the html
function from Cheerio; the result:
const html = output.$.html();
// <body>[object Object]</body>
I'm not sure, if that output is correct; I mean, if is espected. But, doing the same using output.$('div')
I've got initialize(0)
.
Since phantomjs
is deprecated, we should deprecate markoDevtools.config.phantomOptions
in favor of a different name that can be module agnostic.
At the moment, the title in the routing examples is not escaped, it shows:
<strong>routing!</strong>
Is it possible to insert html into the title property? I don't think so. It would be probably better to change the code to
<@title> Hello ${input.params.name}! </@title>
in index.marko
marko create myapp
We meet the following error after Lasso released v3 when run Marko dev UT.
/<our project root>/node_modules/marko/dist/compiler/Compiler.js:85
throw error;
^
Error: An error occurred while trying to compile template at path "/<our project root>/node_modules/marko-devtools/src/commands/test/util/browser-tests-runner/page-template.marko". Error(s) in template:
1) [node_modules/marko-devtools/src/commands/test/util/browser-tests-runner/page-template.marko:1:0] Unrecognized tag: lasso-page - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
2) [node_modules/marko-devtools/src/commands/test/util/browser-tests-runner/page-template.marko:8:8] Unrecognized tag: lasso-head - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
3) [node_modules/marko-devtools/src/commands/test/util/browser-tests-runner/page-template.marko:15:8] Unrecognized tag: lasso-body - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
4) [node_modules/marko-devtools/src/commands/test/util/browser-tests-runner/page-template.marko:19:8] Unrecognized tag: lasso-slot - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
at handleErrors (/<our project root>/node_modules/marko/dist/compiler/Compiler.js:83:21)
at Compiler.compile (<our project root>/node_modules/marko/dist/compiler/Compiler.js:152:9)
at _compile (/<our project root>/node_modules/marko/dist/compiler/index.js:101:33)
at Object.compile (/<our project root>/node_modules/marko/dist/compiler/index.js:115:12)
at compile (/<our project root>/node_modules/marko/dist/node-require/index.js:53:41)
at Object.markoRequireExtension [as .marko] (/<our project root>/node_modules/marko/dist/node-require/index.js:120:27)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
Marko-devtool declares Lasso dependency to be any version ('*'), which will cause problems when Lasso is not-downward-compatibility updated.
Once the app is created it would be nice to print something like
To run your app, use the following commands:
cd my-first-marko-app
npm start
The following should be supported:
marko test --server
Test file:
test('my test', function(context) {
return new Promise((resolve, reject) => {
setTimeout(function () {
resolve();
}, 1000)
})
});
Right now, test coverage is only being reported for .js
and .es6
files. We should also be reporting test coverage for Marko templates.
yarn global add marko-cli
and it did not install commands/test/...
There are sometime directories that you do not want to compile Marko templates in that are nested inside of directories that should be compiled. For example, you have a package.json
inside of a folder which creates a node_modules
folder. You want to compile all Marko templates outside of the nested node_modules
folder.
Example:
marko compile --ignore ./src/**/node_modules/** --files ./src/**/*.marko
Docs say markoc my-template.marko
will output my-template.js
but it outputs my-template.marko.js
which makes require statements fail.
Given the following script, I cannot run build && rm -rf dist && build
Per @patrick-steele-idem , it has to do with .cache
directory and speeding up production builds. (as a separate issue: invisible / hidden files are probably bad form! ... maybe ./dist-cache instead?)
Assuming marko create ...
is the preferred and documented way of onboarding new people to using marko, I propose the following:
add a command npm run clean
or npm run build-clean
... as-is, it's really nasty for someone new to marko to run npm run build && rm -rf dist && npm run build
and assume marko is buggy / broken because no files are generated / built
default npm run build
to avoid/skip/clear the cache directory or make it clear that marko-starter build --use-cache / --skip-cache / --cache=./.cache
has caching going on.
From talking with Patrick it feels like the builds are expected to be done on prod machines, and only once. For my general development practices, I often run "prod" builds on my local machine to verify file sizes, make a final test run before building/pushing, etc.
$ cat repro.sh
rm -rf ./try-to-repro
marko create try-to-repro
cd try-to-repro
yarn install > /dev/null
NODE_ENV=production npm run build > /dev/null
find ./dist/ -type f | xargs -n1 -I{} bash -c 'echo -n "{} " ; gzip -c {} | wc -c'
rm -rf ./dist
perl -p -i -e 's/Click.me/Do it/g' ./components/click-count/index.marko
perl -p -i -e 's/count:0/count:9/g' ./components/click-count/index.marko
NODE_ENV=production npm run build > /dev/null 2> /dev/null
find ./dist/ -type f | xargs -n1 -I{} bash -c 'echo -n "{} " ; gzip -c {} | wc -c'
I think it would be nice to support both a test
directory and test files alongside your component. Many people will only ever use a single test file.
Both of the following would be supported:
/components/my-component
/test
test.js
index.marko
/components/my-component
index.marko
test.js
If we are in agreement, I can work on this.
In the template.marko
file I use the lasso-img
tag. This results in an error:
marko test src/components/app-header
Server running at http://localhost:8080
Running "http://localhost:8080" using mocha-phantomjs...
src\components\app-header
1) app-header
0 passing (16ms)
1 failing
1) src\components\app-header app-header:
Not allowed
When I execute the test only on the server I get
1) src\components\app-header app-header:
Error: beginAsync() not allowed when using renderSync()
at AsyncStream.beginAsync (E:\Repositorys\proto\app-landingpage\node_modules\marko\runtime\html\AsyncStream.js:113:19)
at module.exports (E:\Repositorys\proto\app-landingpage\node_modules\lasso\taglib\helper-getImageInfo.js:5:24)
at render (E:\Repositorys\proto\app-landingpage\src\components\app-header\template.marko.js:13:3)
When I removed it, it works.
Update files to use MarkoCLI instead of MarkoDevTools.
I just create a new app using marko-cli and when run marko test
:
Server running at http://localhost:1024
Running "http://localhost:1024" using mocha-phantomjs...
Error: Cannot find module "/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/BrowserContext" from "/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner"
in requireModule at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:434
in instanceRequire at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:130
at http://localhost:1024/static/browser-tests-runner/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/setup.js:1
in load at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:165
in requireModule at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:466
in require at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:472
in run at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:485
in ready at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:506
Error loading resource http://localhost:1024/static/browser-tests-runner/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/mocha-run.js (5). Details: Operation canceled
Error loading resource http://localhost:1024/static/browser-tests-runner/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/mocha-run-run.js (5). Details: Operation canceled
Exiting, closing server...
~/Projects/myapp (master) -> npm install marko-cli -g
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/Users/jesse/.nvm/versions/node/v8.0.0/bin/marko -> /Users/jesse/.nvm/versions/node/v8.0.0/lib/node_modules/marko-cli/bin/marko
updated 1 package in 47.918s
~/Projects/myapp (master) -> marko test
Server running at http://localhost:1024
Running "http://localhost:1024" using mocha-phantomjs...
Error: Cannot find module "/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/BrowserContext" from "/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner"
in requireModule at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:434
in instanceRequire at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:130
at http://localhost:1024/static/browser-tests-runner/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/setup.js:1
in load at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:165
in requireModule at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:466
in require at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:472
in run at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:485
in ready at http://localhost:1024/static/browser-tests-runner/lasso-modules-client$2.0.4/src/index.js:506
Error loading resource http://localhost:1024/static/browser-tests-runner/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/mocha-run.js (5). Details: Operation canceled
Error loading resource http://localhost:1024/static/browser-tests-runner/marko-cli$1.0.0/src/commands/test/util/browser-tests-runner/mocha-run-run.js (5). Details: Operation canceled
Exiting, closing server...
My test:
var expect = require('chai').expect;
test('variant-danger', function(context) {
var output = context.render({ variant: 'danger' });
expect(output.html).to.contain('app-button-danger');
});
My stack is Node 8
and NPM 5
This file is missing in the dist, and so the tests cannot run.
The following should cause the test to fail:
test('my test', function (context, done) {
done(new Error('Error!'))
});
This is to extend the #6 further. In short, I'd like to use following organization of files,
/components/mycomponent.marko
/components/mycomponent-test.js
I'm raising this because, per this Pro Tip, markojs seems to encourage use of single file component. So I would like to see test file along side this file too, save another folder, compared to #6.
Let's stretch it further a bit, is it possible to write test inside the single file component, and let bundler to auto-strip the test during production build.
Right now, if you are not using the standard component structure where the component name is index.marko
, template.marko
, or renderer.marko
, marko-devtools
cannot find your tests. We should allow the testMatcher
to return a componentName
and rendererPath
.
I noticed when running npm run build
the bundle filenames are long and shows full path of project's location:
Users-<username>-<long-project-folder-path>-src/<component>marko.init-<hash>.js
I feel like that could be a security issue, and generally better with shorter names.
Is it because of lasso? Any chance having a sane default config in .projectConfig()
to name the bundles with something other than the project path?
Global installation
$ sudo npm install -g marko-devtools
npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/bin/marko -> /usr/lib/node_modules/marko-devtools/bin/marko
/usr/lib
└── [email protected]
marko create
$ marko create marko-test
fs.js:640
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/usr/lib/node_modules/marko-devtools/src/commands/test/util/browser-tests-runner/.21733.1488780531669.page-template.marko.js'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at compile (/usr/lib/node_modules/marko-devtools/node_modules/marko/node-require.js:60:16)
at Object.markoRequireExtension [as .marko] (/usr/lib/node_modules/marko-devtools/node_modules/marko/node-require.js:120:27)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
$ marko
and $ marko test
cause the same error.
$ sudo marko create
works, but resulting files are owned by root.
Folder denied access
$ ls -al /usr/lib/node_modules/marko-devtools/src/commands/test/util/browser-tests-runner/
total 36
drwxr-xr-x 2 nobody jordan 4096 Mar 6 00:08 .
drwxr-xr-x 4 nobody jordan 4096 Mar 6 00:08 ..
-rw-r--r-- 1 nobody jordan 2194 Mar 4 13:29 BrowserContext.js
-rw-r--r-- 1 nobody jordan 8005 Mar 4 13:29 index.js
-rw-r--r-- 1 nobody jordan 814 Mar 4 13:29 .jshintrc
-rw-r--r-- 1 nobody jordan 19 Mar 4 13:29 mocha-run.js
-rw-r--r-- 1 nobody jordan 393 Mar 4 13:29 page-template.marko
-rw-r--r-- 1 nobody jordan 1683 Mar 4 13:29 setup.js
Version info
$ lsb_release -d
Description: Ubuntu 16.04.2 LTS
$ node -v
v6.10.0
$ npm -v
4.3.0
Local installs work fine
$ node_modules/.bin/marko create marko-test
No errors.
Steps to reproduce:
npm run lint
It displays 4 errors:
color-picker-tutorial/src/components/color-picker-footer/component.js
5:18 error Parsing error: The keyword 'class' is reserved
color-picker-tutorial/src/components/color-picker-header/test.js
2:1 error Parsing error: The keyword 'const' is reserved
color-picker-tutorial/src/components/color-picker-selection/test.js
2:1 error Parsing error: The keyword 'const' is reserved
color-picker-tutorial/src/components/color-picker/utils/getColors.js
1:1 error Parsing error: The keyword 'const' is reserved
✖ 4 problems (4 errors, 0 warnings)
I assume this is because the generated project misses an eslintrc.json file
I'm using nyc as directed, to generate code coverage. My .nycrc
file looks like this:
{
"exclude": [
"**/test",
"**/*.marko.js",
"common/test-utils"
],
"report-dir": "./.coverage",
"all": true
}
The exclusions work fine on the server testing, but are not respected in browser tests. In the browser tests, even the .marko
files get included in coverage, despite any exclusion rules against them.
This is a single file component
class {
onInput(input) {
return {
size: input.size || 'btn btn-default',
variant: input.variant,
body: input.label || input.renderBody,
className: input['class']
};
}
handleClick(event) {
// Every Widget instance is also an EventEmitter instance.
// We will emit a custom "click" event when a DOM click event
// is triggered
this.emit('click', {
event: event // Pass along the DOM event in case it is helpful to others
});
}
}
style.less {
.app-button {
width: 100%;
margin-top: 50px;
}
}
$ var variantClassName = input.variant
$ var sizeClassName = input.size
<button class=[
'app-button',
variantClassName,
sizeClassName,
input.className
] ${input['*']} onClick("handleClick")>
<span>
<include(input.body)/>
</span>
</button>
When I run marko test src/components/app-button
Error
C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\lasso\lib\dependencies\DependencyRegistry.js:404
throw new Error('Dependency of type "' + type + '" is not supported. (dependency=' + require('util').inspect(config) + ', package="' + filename + '"). Registered types:\n' + Object.keys(this.registeredTypes).join(', '));
^
Error: Dependency of type "less" is not supported. (dependency={ type: 'less',
code: '.app-button {\r\n width: 100%;\r\n margin-top: 50px;\r\n }',
Currently after downloading and installing a template project, you get the following:
✔ Successfully created app! To get started, run:
cd test-noo
npm start
It would be nice to also show other things you can do in a project, like npm run build
or how to launch in production mode.
Because we allow using any repo as a template project, it might be best to allow the repo to determine what gets printed to the console. I'm thinking using content from the README of the project might be a good way to do that. Perhaps having a specific markdown heading that marko create
looks for and then printing the contents of that section to the console. There are a number of options for printing markdown to the terminal:
I'm just getting into marko and following the documentation. I've installed marko with yarn and I'm not sure if this is intended but when I go to create a project with marko create hello-world
I get this:
It looks like the path gets cut off due to the space. When I rename the Web App Development folder to Web-App-Development it works. I'm just not sure that this is intended because other cli's don't have this problem.
We should move each command's functionality out into a separate package and document the functions' public API. We then pull those packages into marko-cli
and use them in the commands.
marko test
-> @marko/test
marko create
-> @marko/create
marko compile
-> @marko/compile
Each of the above scoped packages will now become dependencies of marko-cli
.
marko test src/components/app-button
C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\marko\compiler\Compiler.js:84
throw error;
^
Error: An error occurred while trying to compile template at path "C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\src\commands\test\util\browser-tests-runner\page-template.marko". Error(s) in template:
1) [C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\src\commands\test\util\browser-tests-runner\page-template.marko:17:8] Unrecognized tag: init-widgets - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
2) [C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\src\commands\test\util\browser-tests-runner\page-template.marko:21:8] Unrecognized tag: browser-refresh - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
at handleErrors (C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\marko\compiler\Compiler.js:82:21)
at Compiler.compile (C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\marko\compiler\Compiler.js:151:9)
at _compile (C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\marko\compiler\index.js:89:33)
at Object.compile (C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\marko\compiler\index.js:103:12)
at compile (C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\marko\node-require.js:52:38)
at Object.markoRequireExtension [as .marko] (C:\Users\dustin\AppData\Roaming\npm\node_modules\marko-devtools\node_modules\marko\node-require.js:120:27)
Your PR #12 will fix that.
marko-starter create ...
...project.js doesn't link to documentation
cat ./dist/src-*.js | gzip -c | wc -c
)beforeBuild
: Runs before the build runsbeforeStartServer
: Runs before the server is startedafterBuild
: Runs after the build is completeafterServerStarted
: Runs after the server has successfully startedyarn create ...
https://yarnpkg.com/lang/en/docs/cli/create/...this is a list of observations on marko-devtools
as a non-core user of marko (ie: no eBay infra, no special access to dev's, "as if i were comparing ember.js, react, and angular.js" to marko).
Honestly there's a ton of good stuff w/ marko-starter
... I especially like the "/routes/.../components" in conjunction with top-level/shared components. To me, marko is approaching "PHP.next" but in a good way, and if marko-starter
included more SPA/offline capabilities I could recommend it 100%. Currently I'm shooting for using marko w/ offline-first as a goal so take some of this feedback with a grain of salt and ideally we can create individual issues for "valid" concerns and mark them / status them separately.
We should allow marko-devtools.js
to be used in the root of the project and show a deprecation warning. This way, the user can gracefully upgrade.
Running npm run eject copies all the configuration files and the transitive dependencies (Marko, lasso etc) right into your project so that developers can have full control over them.
It's easy for developers to know all the dependencies in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.