I have a little bash script that might help.

Let's say you have the folder `~/tests` ... you can prepare the fodler as
such.

```sh
# go into the folder
cd ~/tests

# prepare 2 dirs
mkdir tmp262
mkdir utils

# will take forever ...
git clone https://github.com/tc39/test262
```

Now, while it's bringing in `test262` you can create a file in
`~/tests/utils` ... let's call it `worker`, and you can copy and paste the
following in it:

```sh
#!/usr/bin/env bash

CURRENT="$(pwd)"
DIR="./"
if [ "${CURRENT:${#CURRENT}-6}" = "/utils" ]; then
  DIR="../"
fi

TMP262=${DIR}tmp262
TEST262=${TMP262}/test262.js

if [ ! -f "$1" ]; then
  mkdir -p $TMP262
  # avoid trailing comma
  echo "[{name:'',test:Object}" > ${TEST262}
  python2 ${DIR}test262/tools/packaging/test262.py --command "$0" --tests
"${DIR}test262/" $@
  echo "].forEach(function(o){console.log(o.name
);try{o.test()}catch(e){console.error(o.name,e)}});" >> ${TEST262}
else
  echo ",{name:'$1',test:function(){" >> ${TEST262}
  cat $1 >> ${TEST262}
  echo "}}" >> ${TEST262}
fi
```

At this point you can `chmod +x ~/tests/utils/worker` and once the git
clone is complete, you can try with:

```sh
./utils/worker built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-5

# or to have a full spec
./utils/worker RegExp
```
In few words you can pass any argument you could pass to the deprecated
console runner.

The result is a file in `~/tests/tmp262/test262.js` which is basically an
array of tests. You can run these with pretty much any engine you want,
hoping it's compatible with the test262 suite.

I know it's not perfect (also the only info it gets about the test at
runtime is the tmp file name) but it does the job in some case.

Best Regards






On Thu, Mar 17, 2016 at 3:44 PM, Boris Zbarsky <[email protected]> wrote:

> On 3/17/16 11:42 AM, Leo Balter wrote:
>
>> The current website needs an update. If it makes less painful to run the
>> tests on a shell, you can try https://github.com/bterlson/eshost
>>
>
> I'm specifically looking for a harness that will run the tests in a web
> worker, so I'm not sure that this helps me... ;)
>
>
> -Boris
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to